예제 #1
0
        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);
            }
        }
예제 #2
0
        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>());
        }
예제 #3
0
        public ActionResult Delete(int id)
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new SkillService(userId);

            service.Delete(id);
            return(RedirectToAction("Index"));
        }
예제 #4
0
        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());
        }
예제 #5
0
 // DELETE: api/Skill/5
 public HttpResponseMessage Delete(int id)
 {
     _skillService.Delete(id);
     return(Request.CreateResponse(HttpStatusCode.OK, string.Empty));
 }
예제 #6
0
 public void RemoveSkill(int id)
 {
     SkillService.Delete(id);
 }