Example #1
0
        public ActionResult DeleteConfirmed(long id)
        {
            PeoplePost people = _peopleService.GetPost(id);

            people.UserName = User.Identity.Name;
            _peopleService.Delete(people);
            return(RedirectToAction("Index"));
        }
Example #2
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            Person person = await _service.GetSingle(id);

            _service.Delete(person);
            return(RedirectToAction("Index"));
        }
Example #3
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            People people = _service.GetPeopleById(id);

            _service.Delete(people.Id);
            return(RedirectToAction("Index"));
        }
Example #4
0
        public async Task <IActionResult> DeleteConfirmed(long id)
        {
            var person = await peopleService.Get(Convert.ToInt64(id));

            await peopleService.Delete(person);

            return(RedirectToAction(nameof(Index)));
        }
 public HttpResponseMessage Delete(int id)
 {
     try
     {
         _personService.Delete(id);
         return(Request.CreateResponse(HttpStatusCode.OK, new SuccessResponse()));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
Example #6
0
 public IActionResult DeleteConfirm(int PersonId)
 {
     if (ModelState.IsValid)
     {
         var result = peopleService.Delete(PersonId);
         if (result)
         {
             return(RedirectToAction("Index"));
         }
     }
     return(RedirectToAction("Detail", new { id = PersonId }));
 }
        public IActionResult Delete(int id)
        {
            Person person = _peopleService.FindById(id);

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

            _peopleService.Delete(id);

            return(Content(""));
        }
Example #8
0
        // DELETE: api/persons/5
        /// <summary>
        /// Deletes a person
        /// </summary>
        /// <remarks>
        /// Allows for deleteing a person resource based on Id
        /// </remarks>
        /// <param name="id"> The person id requested to be deleted.</param>
        /// <returns></returns>
        /// <seealso cref="Person"/>
        /// <response code="200"></response>
        public async Task <IHttpActionResult> Delete(int id)
        {
            try
            {
                var deleted = await _peopleService.Delete(id);

                if (deleted == false)
                {
                    return(NotFound());
                }

                // Return Ok no content.
                return(Ok());
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Example #9
0
        public async Task <IActionResult> DeletePerson([FromRoute] int id)
        {
            var deleteePersonId = id.ToString();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var task          = Task.Run(() => _peopleService.Delete(id));
            var executeResult = await task;

            if (!executeResult)
            {
                return(NotFound());
            }

            return(Ok());
        }
Example #10
0
 public IActionResult DeleteConfirmed(Guid id)
 {
     _peopleService.Delete(id);
     return(RedirectToAction(nameof(Index)));
 }
Example #11
0
 public void Delete(People people)
 {
     service.Delete(people);
 }