예제 #1
0
        public MusicController(StaffsViewModel staffs, Editor edit)
        {
            fileManager     = new FileManager();
            psamContolLib   = new PsamContolLib();
            staffsViewModel = staffs;
            editor          = edit;

            musicPlayer = new SanfordLib();
        }
예제 #2
0
        public ActionResult Index()
        {
            var staffs = _staffRepository.AllStaff.ToList();
            var model  = new StaffsViewModel()
            {
                AllStaff = staffs
            };

            return(View(model));
        }
예제 #3
0
        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));
        }
예제 #4
0
        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());
        }