private Manager ManagerToDal(ManagerDto Mdto)
 {
     if (Mdto != null)
     {
         return new Manager()
                {
                    //Id = Mdto.Id,
                    IdentityNumber = Mdto.IdentityNumber,
                    FirstName      = Mdto.FirstName,
                    LastName       = Mdto.LastName,
                    Email          = Mdto.Email,
                    PhoneNumber    = Mdto.PhoneNumber,
                    CellNumber     = Mdto.CellNumber,
                    Address        = Mdto.Address,
                    BirthDate      = Mdto.BirthDate,
                    UserName       = Mdto.UserName,
                    Password       = Mdto.Password
                }
     }
     ;
     else
     {
         return(null);
     }
 }
Exemple #2
0
        public void addManager(ManagerDto m)
        {
            Manager m1 = ManagerToDal(m);

            if (!IsExist(m1))
            {
                db.Manager.Add(m1);
            }
        }
 public void AddManager(ManagerDto NewManager)
 {
     //   ShachlavDB db = new ShachlavDB();
     if (IsExist(NewManager) == false)
     {
         db.Managers.Add(ManagerToDal(NewManager));
         db.SaveChanges();
     }
 }
        private bool IsExist(ManagerDto manager)
        {
            Boolean exist = false;

            db.Managers.ToList().ForEach(x =>
            {
                if (x.IdentityNumber == manager.IdentityNumber && x.FirstName == manager.FirstName && x.LastName == manager.LastName)
                {
                    exist = true;
                }
            });
            return(exist);
        }
Exemple #5
0
 public Manager ManagerToDal(ManagerDto m)
 {
     return(new Manager()
     {
         FirstName = m.FirstName,
         Address = m.Address,
         BirthDate = m.BirthDate,
         CellNumber = m.CellNumber,
         Email = m.Email,
         IdentityNumber = m.IdentityNumber,
         Password = m.Password,
         LastName = m.LastName,
         PhoneNumber = m.PhoneNumber,
         UserName = m.UserName,
         Id = m.Id
     });
 }
        public void UpdateManager(ManagerDto UpManager)
        {
            //  ShachlavDB db = new ShachlavDB();
            Manager Ezer = db.Managers.FirstOrDefault(m => m.Id == UpManager.Id);

            if (Ezer != null)
            {
                Ezer.IdentityNumber = UpManager.IdentityNumber;
                Ezer.FirstName      = UpManager.FirstName;
                Ezer.LastName       = UpManager.LastName;
                Ezer.Email          = UpManager.Email;
                Ezer.PhoneNumber    = UpManager.PhoneNumber;
                Ezer.CellNumber     = UpManager.CellNumber;
                Ezer.Address        = UpManager.Address;
                Ezer.BirthDate      = UpManager.BirthDate;
                Ezer.UserName       = UpManager.UserName;
                Ezer.Password       = UpManager.Password;
                db.SaveChanges();
            }
        }
Exemple #7
0
        public void updateManager(ManagerDto m)
        {
            Manager m1 = ManagerToDal(m);

            foreach (Manager mFound in db.Manager)
            {
                if (mFound.Id == m1.Id)
                {
                    mFound.FirstName      = m1.FirstName;
                    mFound.Address        = m1.Address;
                    mFound.BirthDate      = m1.BirthDate;
                    mFound.CellNumber     = m1.CellNumber;
                    mFound.Email          = m1.Email;
                    mFound.IdentityNumber = m1.IdentityNumber;
                    mFound.Password       = m1.Password;
                    mFound.LastName       = m1.LastName;
                    mFound.PhoneNumber    = m1.PhoneNumber;
                    mFound.UserName       = m1.UserName;
                }
            }
        }