Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id, string confirmText)
        {
            var holiday = _holidayRepository.Find(id);
            var success = false;
            string error = "";
            if (holiday == null)
            {
                error = "Không tìm thấy sự kiện";
            }else if(confirmText.ToLower() != "đồng ý")
            {
                error = "Chuỗi nhập vào chưa đúng";
            }
            else
            {
                using (new Impersonator("uploaduser", "", "Upload@@123"))
                {
                    string filePath = VITV.Web.Helpers.UrlHelper.GetPhysicalPath(this, holiday.LeftFixedBkgr);
                    if (System.IO.File.Exists(filePath))
                    {
                        System.IO.File.Delete(filePath);
                    }

                    filePath = VITV.Web.Helpers.UrlHelper.GetPhysicalPath(this, holiday.RightFixedBkgr);
                    if (System.IO.File.Exists(filePath))
                    {
                        System.IO.File.Delete(filePath);
                    }
                }
                _holidayRepository.Delete(id);
                _holidayRepository.Save();
                success = true;
            }
            return Json(new { success = success, id = id, error = error });
        }
Exemplo n.º 2
0
        public bool Delete(int?Id)
        {
            var idDel = Get(Id);

            if (idDel != null)
            {
                status = _holidayRepository.Delete(Id);
            }
            return(status);
        }
Exemplo n.º 3
0
        public ActionResult Delete(int id)
        {
            var apiResult = TryExecute(() =>
            {
                _holidayRepository.Delete(id);
                _unitOfWork.Commit();
                return(true);
            }, "Holiday deleted sucessfully");

            return(Json(apiResult, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Delete(int Id)
        {
            DateTime holidayDate = holidayRepository.GetHoliday(Id).DateOfHoliday;

            if (holidayDate.DayOfWeek != DayOfWeek.Saturday && holidayDate.DayOfWeek != DayOfWeek.Sunday)
            {
                await deleteHolidayAdjustment(holidayDate, userManager, requestRepository, emailSender);
            }
            holidayRepository.Delete(Id);
            return(RedirectToAction("index"));
        }
Exemplo n.º 5
0
        public ActionResult <CommonResponeModel> Delete(long Id)
        {
            int result = holidayRepository.Delete(Id);

            if (result > 0)
            {
                Result = new SuccessResultFactory().Factory(ActionType.Delete);
            }
            else
            {
                Result = new ErrorResultFactory().Factory(ActionType.Delete);
            }

            return(GetCommonRespone());
        }
        public async Task <Unit> Handle(DeleteHolidayCommand request, CancellationToken cancellationToken)
        {
            var holiday = await HolidayRepository.Get(request.Id);

            if (holiday == null)
            {
                throw new ArgumentOutOfRangeException("Holiday does not exist.");
            }

            await HolidayRepository.Delete(holiday);

            await Mediator.Publish(new HolidayDeletedEvent { Id = holiday.Id });

            return(await Unit.Task);
        }
Exemplo n.º 7
0
 public void DeleteHoliday(int id)
 {
     _holidayRepository.Delete(id);
 }
Exemplo n.º 8
0
 public void Delete(long holidayid)
 {
     _repository.Delete(holidayid);
     _uow.Commit();
 }
Exemplo n.º 9
0
 public bool Delete(int id)
 {
     return(iHolidayRepository.Delete(id));
 }