public MusicController(StaffsViewModel staffs, Editor edit) { fileManager = new FileManager(); psamContolLib = new PsamContolLib(); staffsViewModel = staffs; editor = edit; musicPlayer = new SanfordLib(); }
public ActionResult Index() { var staffs = _staffRepository.AllStaff.ToList(); var model = new StaffsViewModel() { AllStaff = staffs }; return(View(model)); }
public ActionResult AddStaff(string check) { string[] arrDeleteId = check.Split(','); List <StaffsViewModel> list = new List <StaffsViewModel>(); for (int i = 0; i < arrDeleteId.Count(); i++) { if (arrDeleteId[i] != "") { var item = StaffsRepository.GetStaffsById(int.Parse(arrDeleteId[i], CultureInfo.InvariantCulture)); if (item != null && item.IsDeleted != true) { var model = new StaffsViewModel(); AutoMapper.Mapper.Map(item, model); list.Add(model); } } } return(View(list)); }
public IHttpActionResult DeleteStaffs(int staffid) { string msgType = "", msgText = "", actionType = "DELETE"; int StaffId = 0; var user = GetCurrentUser(); StaffsViewModel staffsVM = GetStaffsById(staffid: staffid); if (staffsVM == null) { return(NotFound()); } try { Staffs staffs = new Staffs() { StaffId = staffsVM.StaffId }; string userId = user.Id; _staffsService.UpdateStaffs(staffs: staffs, actionType: actionType, userId: userId, msgType: ref msgType, msgText: ref msgText, returnStaffId: ref StaffId); } catch (Exception e) { var modelStateDictionary = new ModelStateDictionary(); if (e.InnerException != null) { modelStateDictionary.AddModelError("InnerException", e.InnerException.Message); } else { modelStateDictionary.AddModelError("InnerException", e.Message); } return(BadRequest(modelStateDictionary)); } return(Ok()); }