Exemplo n.º 1
0
        public ActionResult Create(HolidayVM model)
        {
            try
            {
                string holidayId = string.Empty;
                model.CreatedBy = LogInManager.LoggedInUserId;

                holidayId = holidayRepository.AddHoliday(model);

                if (!string.IsNullOrWhiteSpace(holidayId))
                {
                    return(Json(new
                    {
                        IsSuccess = true,
                        data = new
                        {
                            HolidayId = holidayId
                        }
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = "Holiday details not saved successfully."
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "Create");
                return(Json(new
                {
                    IsSuccess = false,
                    errorMessage = e.Message
                }));
            }
        }