using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Models
{
    public class DatabaseContextInitializer :
        System.Data.Entity.DropCreateDatabaseIfModelChanges<DatabaseContex>
    {
        protected override void Seed(DatabaseContex context)
        {

            Models.User oUser = null;

            oUser = new User();

            oUser.FirstName = "حمیدرضا";
            oUser.LastName = "پهلوان";
            oUser.Username = "administrator";
            oUser.Password = "12345";
            oUser.isActive = 1;
            oUser.Avatar = "test.jpg";
            oUser.Email = "info@crystalweb.ir";
            oUser.Role = "administrator";
            context.Users.Add(oUser);
            context.SaveChanges();





            context.Database.ExecuteSqlCommand("ALTER TABLE Users ADD CONSTRAINT uc_username UNIQUE(Username)");
            base.Seed(context);
        }
    }
}