public ActionResult Delete(int id)
 {
     try
     {
         // TODO: Add delete logic here
         serve.Delete(id);
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         return(View(ex.Message));
     }
 }
 public async Task <IHttpActionResult> Delete([FromUri] Guid id, [FromUri(Name = "delete_child_nodes")] bool deleteChildNodes = false)
 {
     if (_planService.IsPlanActiveOrExecuting(id))
     {
         return(new LockedHttpActionResult());
     }
     if (deleteChildNodes)
     {
         await _activityService.DeleteChildNodes(id);
     }
     else
     {
         await _activityService.Delete(id);
     }
     return(Ok());
 }
Пример #3
0
        /// <summary>
        /// Remove Subplan and children entities by id.
        /// </summary>
        public async Task Delete(IUnitOfWork uow, Guid id)
        {
            var subPlan = uow.PlanRepository.GetById <SubplanDO>(id);

            if (subPlan == null)
            {
                throw new MissingObjectException($"Subplan with Id {id} doesn't exist");
            }

            foreach (var activity in subPlan.ChildNodes.OfType <ActivityDO>())
            {
                await _activity.Delete(activity.Id);
            }

            subPlan.RemoveFromParent();

            uow.SaveChanges();
        }
        // DELETE api/<controller>/5
        public IHttpActionResult Delete(int id)
        {
            try
            {
                if (id <= 0)
                {
                    return(BadRequest());
                }

                var isEntityExists = _activityService.GetActivity(id);

                if (isEntityExists == null)
                {
                    return(NotFound());
                }

                _activityService.Delete(id);
                return(StatusCode(HttpStatusCode.NoContent));
            }
            catch (Exception ex)
            {
                return(InternalServerError());
            }
        }
Пример #5
0
 public Task Delete(Guid id)
 {
     return(_activity.Delete(id));
 }
 public ResultModel Delete(int id)
 {
     return(_svr.Delete(id, AppUser));
 }