Exemple #1
0
 public ActionResult Create(CleaningStaffByLocationViewModel collection)
 {
     try
     {
         //  collection.CleaningStaffByLocation.ApprovedBy = User.Identity.Name == "" ? "Naveed" : User.Identity.Name;
         if (collection.CleaningStaffByLocation.Id > 0)
         {
             //collection.StudentFeedBackReport.ModifiedOn = DateTime.Now;
             //collection.StudentFeedBackReport.ModifiedBy = User.Identity.Name == "" ? "Naveed" : User.Identity.Name;
             unitofwork.CleaningStaffByLocationRepository.Update(collection.CleaningStaffByLocation);
         }
         else
         {
             //collection.StudentFeedBackReport.CreatedOn = DateTime.Now;
             //collection.StudentFeedBackReport.CreatedBy = User.Identity.Name == "" ? "Naveed" : User.Identity.Name;
             unitofwork.CleaningStaffByLocationRepository.Insert(collection.CleaningStaffByLocation);
         }
         unitofwork.Save();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Exemple #2
0
        // GET: StudentFeedBackReport/Create
        public ActionResult Create(int?id)
        {
            CleaningStaffByLocationViewModel model = new CleaningStaffByLocationViewModel();

            model.StaffTypeListItems = LoadStafftype();
            var t = (from m in db.HREmployeeMsts join q in db.Accounts on m.AccountId equals q.Id select q);

            model.StaffListItems = t.Select(x => new SelectListItem()
            {
                Text = x.AccountName, Value = x.Id.ToString()
            }).ToList();
            if (id > 0)
            {
                model.CleaningStaffByLocation = db.CleaningStaffByLocations.Where(x => x.Id == id).FirstOrDefault();
            }
            return(View(model));
        }