예제 #1
0
        public async Task <IHttpActionResult> Remove(int planId)
        {
            try
            {
                int userId = (await CurrentUser()).Id;

                Plan plan = _planService.Find(planId);
                if (plan != null)
                {
                    if (userId == plan.CreatorId)
                    {
                        bool result = _planService.Delete(plan);

                        if (result)
                        {
                            return(Ok());
                        }
                    }
                    else
                    {
                        return(Unauthorized());
                    }
                }

                return(BadRequest());
            }
            catch (Exception ex)
            {
                _loggingService.Write(GetType().Name, nameof(Remove), ex);

                return(InternalServerError(ex));
            }
        }
예제 #2
0
        public IActionResult ConfirmRemove(int id)
        {
            recipePlanService.DeleteAllWithPlanId(id);
            planService.Delete(id);

            return(RedirectToAction("List"));
        }
예제 #3
0
 public async Task <IActionResult> Delete(int id)
 {
     if (await _planService.Delete(id))
     {
         return(NoContent());
     }
     throw new Exception("Error deleting the model no");
 }
예제 #4
0
        public IActionResult Delete(Plan plan)
        {
            var result = _planService.Delete(plan);

            if (result.Success)
            {
                return(Ok(result.Message));
            }

            return(BadRequest(result.Message));
        }
예제 #5
0
        public async Task <IActionResult> Delete(int id)
        {
            var model = await _planService.Delete(id);

            if (model)
            {
                await _hubContext.Clients.All.SendAsync("ReceiveCreatePlan");

                return(NoContent());
            }
            throw new Exception("Error deleting the model no");
        }
        public ActionResult Delete(string type, Guid id, DateTime date)
        {
            if (type == "Delete")
            {
                _iPlanService.Delete(id);
            }
            if (type == "Finish")
            {
                _iPlanService.Finish(id);
            }

            _unitOfWork.Commit();
            return(RedirectToAction("Index", new { date }));
        }
예제 #7
0
        public IActionResult RemovePlan([FromForm] ConfirmRemovePlanViewModel model)
        {
            try
            {
                _planService.Delete(model.PlanId);
            }
            catch
            {
                return(RedirectToAction("ConfirmRemovePlan", new { id = model.PlanId }));

                ;
            }
            return(RedirectToAction("List"));
        }
예제 #8
0
        public async Task <IActionResult> DeleteEmployee(int id)
        {
            if (id <= 0)
            {
                return(BadRequest());
            }

            var employee = await _planService.GetPlanById(id);

            if (employee == null)
            {
                return(NotFound());
            }
            await _planService.Delete(id);

            return(Ok());
        }
예제 #9
0
        public ActionResult Edit(FormCollection item)
        {
            string nativeeditor_status = item[4];

            switch (nativeeditor_status)
            {
            case "inserted":
                _iPlanService.Save(null,
                                   new Plan
                {
                    PlanTitle = item[2],
                    StartDate = DateTime.Parse(item[0]),
                    EndDate   = DateTime.Parse(item[1])
                });
                break;
            }

            nativeeditor_status = item[5];

            switch (nativeeditor_status)
            {
            case "deleted":
                _iPlanService.Delete(Guid.Parse(item[0]));
                break;

            case "updated":

                Plan plan = _iPlanService.GetById(Guid.Parse(item[0]));

                plan.PlanTitle = item[1];
                plan.StartDate = DateTime.Parse(item[2]);
                plan.EndDate   = DateTime.Parse(item[3]);

                _iPlanService.Save(Guid.Parse(item[0]), plan);
                break;
            }

            _unitOfWork.CommitAsync();

            return(null);
        }
예제 #10
0
 public ActionResult Delete(Guid id)
 {
     _iPlanService.Delete(id);
     _unitOfWork.Commit();
     return(Content("True"));
 }
예제 #11
0
 public async Task <ActionResponse <PlanDto> > Delete([FromBody] SimpleRequestBase request)
 {
     return(await planService.Delete(request.Id));
 }
예제 #12
0
 public ActionResult Delete(int id)
 {
     return(Ok(
                planService.Delete(id)
                ));
 }