public ActionResult DeleteSkill(SkillModel model) { try { #region " [ Declaration ] " SkillService _service = new SkillService(); #endregion #region " [ Main process ] " model.CreateBy = UserID; model.DeleteBy = UserID; model.DeleteDate = DateTime.Now; #endregion //Call to service return(this.Json(_service.Delete(model), JsonRequestBehavior.AllowGet)); } catch (ServiceException serviceEx) { throw serviceEx; } catch (DataAccessException accessEx) { throw accessEx; } catch (Exception ex) { throw new ControllerException(FILE_NAME, "DeleteSkill", UserID, ex); } }
public void DeleteSkill_InvalidSkillId_ShouldBeThrownValidationException() { Mock <IUnitOfWork> uow = new Mock <IUnitOfWork>(); SkillService service = new SkillService(uow.Object); uow.Setup(a => a.Skills.Get(It.IsAny <int>())).Returns((Skill)null); service.Delete(It.IsAny <int>()); }
public ActionResult Delete(int id) { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new SkillService(userId); service.Delete(id); return(RedirectToAction("Index")); }
public void DeleteSkill_DeletedSkillWithCorrectId_ShouldBeDeleted() { Mock <IUnitOfWork> uow = new Mock <IUnitOfWork>(); SkillService service = new SkillService(uow.Object); uow.Setup(a => a.Skills.Get(It.IsAny <int>())).Returns(new Skill()); service.Delete(It.IsAny <int>()); uow.Verify(x => x.Save()); }
// DELETE: api/Skill/5 public HttpResponseMessage Delete(int id) { _skillService.Delete(id); return(Request.CreateResponse(HttpStatusCode.OK, string.Empty)); }
public void RemoveSkill(int id) { SkillService.Delete(id); }