public JsonResult AjaxTypeDelete(DownTimeModel downTime)
        {
            TPO.Web.Core.ResponseMessage responseMessage;

            try
            {
                if (downTime != null)
                {
                    DownTimeDto dto = new DownTimeDto();
                    using (DownTimeService service = new DownTimeService())
                    {
                        Mapper.Map(downTime, dto);
                        if (downTime.ID > 0)
                        {
                            service.Delete(dto.ID);
                        }
                    }
                }

                responseMessage = SetResponseMesssage(ActionTypeMessage.SuccessfulDelete);
            }
            catch (Exception exc)
            {
                responseMessage = SetResponseMesssage(ActionTypeMessage.FailedSave, exc.Message);
            }

            return(Json(responseMessage, JsonRequestBehavior.AllowGet));
        }
        public JsonResult AjaxTypeUpdate(DownTimeModel downTime)
        {
            TPO.Web.Core.ResponseMessage responseMessage;

            try
            {
                if (downTime != null)
                {
                    downTime.LastModified = DateTime.Now;
                    DownTimeDto dto = new DownTimeDto();
                    using (DownTimeService service = new DownTimeService())
                    {
                        Mapper.Map(downTime, dto);

                        if (downTime.ID > 0)
                        {
                            dto.ModifiedBy = CurrentUser;
                            service.Update(dto);
                        }
                        else
                        {
                            dto.ModifiedBy  = CurrentUser;
                            dto.EnteredBy   = CurrentUser;
                            dto.DateEntered = DateTime.Now;
                            dto.PlantID     = CurrentPlantId;
                            service.Add(dto);
                        }
                    }
                }

                responseMessage = SetResponseMesssage(ActionTypeMessage.SuccessfulSave);
            }
            catch (Exception exc)
            {
                responseMessage = SetResponseMesssage(ActionTypeMessage.FailedSave, exc.Message);
            }

            return(Json(responseMessage, JsonRequestBehavior.AllowGet));
        }