Exemple #1
0
        //private bool DoDeleteProject() {

        //    var service = new ProjectAppSvcGeneric();
        //    var delete = service.Delete();
        //    return View();
        //}

        public ActionResult Delete(int id)
        {
            var service = new ProjectAppSvcGeneric();
            var delete  = service.Delete(id);

            return(RedirectToAction("List"));
        }
Exemple #2
0
        public void DeleteTest()
        {
            var svc = new ProjectAppSvcGeneric();

            var objProject = new Project {
                Id = 2
            };

            var result = svc.Delete(objProject.Id);

            Assert.IsNotNull(result);
            Assert.IsTrue(result);
        }
        public IHttpActionResult Delete(int id)
        {
            if (id < 0)
            {
                return(BadRequest());
            }

            var svc     = new ProjectAppSvcGeneric();
            var project = svc.Get(id);

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

            var result = svc.Delete(id);

            return(result ? StatusCode(HttpStatusCode.NoContent) : StatusCode(HttpStatusCode.InternalServerError));
        }