public async Task <IActionResult> PutByNumber(int key, [FromBody] OverTimeDetail uOverTimeDetail)
        {
            uOverTimeDetail.ModifyDate = DateTime.Now;
            uOverTimeDetail.Modifyer   = uOverTimeDetail.Modifyer ?? "Someone";

            return(new JsonResult(await this.repository.UpdateAsync(uOverTimeDetail, key), this.DefaultJsonSettings));
        }
        public async Task <IActionResult> Post([FromBody] OverTimeDetail nOverTimeDetail)
        {
            nOverTimeDetail.CreateDate = DateTime.Now;
            nOverTimeDetail.Creator    = nOverTimeDetail.Creator ?? "Someone";

            return(new JsonResult(await this.repository.AddAsync(nOverTimeDetail), this.DefaultJsonSettings));
        }
        //GET: OverTime/Details
        public ActionResult Details(int id)
        {
            //OverTimeServices service = new OverTimeServices();
            OverTimeDetail model = service.GetOTById(id);

            return(View(model));
        }
        // // // // // // // //

        //GET: OverTime/Work/{id}
        public ActionResult Work(int id)
        {
            //OverTimeServices service = new OverTimeServices();
            OverTimeDetail detail = service.GetOTById(id);
            OverTimeWork   model  = new OverTimeWork
            {
                OTId        = detail.OTId,
                IsAvailable = detail.IsAvailable,
                OTDay       = detail.OTDay,
                HoursWorked = detail.HoursWorked
            };

            return(View(model));
        }
        //GET: OverTime/Edit/{id}
        public ActionResult Edit(int id)
        {
            //OverTimeServices service = new OverTimeServices();
            OverTimeDetail detail = service.GetOTById(id);
            OverTimeEdit   model  = new OverTimeEdit
            {
                OTId = detail.OTId,
                //IsAvailable = detail.IsAvailable,
                OTDay = detail.OTDay,
                //HoursWorked = detail.HoursWorked
                Days = detail.Days
            };

            return(View(model));
        }
Esempio n. 6
0
        public void Edit(decimal id, OverTimeProxy viewModel)
        {
            try
            {
                OverTimeDetail model = OverTimeDetailBusiness.GetByID(id);

                model.MaxHoliday  = viewModel.MaxHoliday;
                model.MaxNightly  = viewModel.MaxNightly;
                model.MaxOverTime = viewModel.MaxOverTime;

                OverTimeDetailBusiness.UpdateOverTimeDetail(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 7
0
        public HttpResponseMessage Edit(decimal id, OverTimeProxy viewModel)
        {
            try
            {
                OverTimeDetail model = OverTimeDetailBusiness.GetByID(id);

                model.MaxHoliday  = viewModel.MaxHoliday;
                model.MaxNightly  = viewModel.MaxNightly;
                model.MaxOverTime = viewModel.MaxOverTime;

                OverTimeDetailBusiness.UpdateOverTimeDetail(model);
                return(Request.CreateResponse(HttpStatusCode.OK, viewModel));
            }
            catch (UIValidationExceptions ex)
            {
                this.exceptionHandler.ApiHandleException("OverTimeController", ex);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.ExceptionList.Count > 0 ? ex.ExceptionList[0].Message : ex.Message));
            }
            catch (Exception ex)
            {
                this.exceptionHandler.ApiHandleException("OverTimeController", ex);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }