public void Create(DailySummaryBM dailySummary)
        {
            DailySummary dailySummaryDM = _mapper.Map <DailySummary> (dailySummary);

            _context.DailySummaries.Add(dailySummaryDM);
            _context.SaveChanges();
        }
        public IActionResult CreateEdit(int?id)
        {
            if (!id.HasValue)
            {
                ViewBag.Mode = "Create";
                return(View());
            }
            else
            {
                DailySummaryBM dailySummary = _dailySummaryReporitory.Get((int)id);
                ViewBag.Mode = "Edit";

                return(View(dailySummary));
            }
        }
        public IActionResult CreateEdit(DailySummaryBM dailySummary)
        {
            if (!dailySummary.Id.HasValue)
            {
                dailySummary.DateCreated = DateTime.Now;

                _dailySummaryReporitory.Create(dailySummary);
            }
            else
            {
                dailySummary.DateModified = DateTime.Now;

                _dailySummaryReporitory.Edit(dailySummary);
            }

            return(RedirectToAction("Index"));
        }
        public bool Edit(DailySummaryBM dailySummary)
        {
            bool isEntityExists = _context.DailySummaries.Any(x => !x.DateDeleted.HasValue && x.Id == dailySummary.Id);

            if (isEntityExists)
            {
                DailySummary dailySummaryDM = _context.DailySummaries.AsNoTracking().First(x => x.Id == dailySummary.Id);

                dailySummaryDM.Desription   = dailySummary.Desription;
                dailySummaryDM.DateModified = DateTime.Now;

                _context.DailySummaries.Update(dailySummaryDM);
                _context.SaveChanges();
            }

            return(isEntityExists);
        }
        public IActionResult RemoveGet(int id)
        {
            DailySummaryBM dailySummary = _dailySummaryReporitory.Get(id);

            return(View(dailySummary));
        }