public IActionResult AddStaff(StaffCommand staffCommand)
 {
     if (ModelState.IsValid)
     {
         this._staffService.AddStaff(staffCommand);
         return(RedirectToAction("AllStaff", "Admin"));
     }
     return(View());
 }
Exemple #2
0
        public void AddStaff(StaffCommand staffCommand)
        {
            var newStaff = new Staff();

            {
                newStaff.Name    = staffCommand.Name;
                newStaff.Phone   = staffCommand.Phone;
                newStaff.DOB     = staffCommand.DOB;
                newStaff.Address = staffCommand.Address;
                newStaff.Gender  = staffCommand.Gender;
            }
            _db.Staffs.Add(newStaff);
            _db.SaveChanges();
        }
Exemple #3
0
        public StaffViewModel()
        {
            //Initialising staff member properties
            this.FirstName   = FirstName;
            this.SecondName  = SecondName;
            this.OtherName   = OtherName;
            this.Id          = Id;
            this.Rank        = Rank;
            this.PhoneNumber = PhoneNumber;
            this.Address     = Address;

            StaffMember  = new StaffCommand();
            RefreshStaff = new UpdateStaffCommand();
        }