public bool SaveUnAvailableDate(UnAvailableViewModel data)
        {
            bool status = false;

            try
            {
                UnAvailableDate unAvailableDate = new UnAvailableDate();
                Mapper.Map(data, unAvailableDate);
                if (data.Id == 0)
                {
                    unAvailableDate.CreatedOn = DateTime.Now;
                    unAvailableDate.IsActive  = true;
                    _Context.UnAvailableDates.Add(unAvailableDate);
                }
                else
                {
                    var res = _Context.UnAvailableDates.Where(x => x.Id == data.Id).FirstOrDefault();
                    res.FromDate = data.FromDate;
                    res.ToDate   = data.ToDate;
                    res.Reason   = data.Reason;
                }
                _Context.Configuration.ValidateOnSaveEnabled = true;
                _Context.SaveChanges();
                return(status = true);
            }
            catch (Exception ex)
            {
                return(status);
            }
        }
Ejemplo n.º 2
0
 public ActionResult AddUnAvailableDate(UnAvailableViewModel data)
 {
     if (adminService.SaveUnAvailableDate(data))
     {
         return(RedirectToAction("ManageUnAvailableDate"));
     }
     else
     {
         return(View());
     }
 }
Ejemplo n.º 3
0
        public ActionResult AddUnAvailableDate(int Id)
        {
            UnAvailableViewModel objModel = new UnAvailableViewModel();

            if (Id != 0)
            {
                var res = adminService.GetUnAvailableDateRec(Id);
                objModel.Id       = res.Id;
                objModel.FromDate = res.FromDate;
                objModel.Reason   = res.Reason;
                objModel.ToDate   = res.ToDate;
                return(View(objModel));
            }
            else
            {
                return(View());
            }
        }