public HttpResponseMessage DeleteDesignation(DesignationModel aDesignationModel)
 {
     try
     {
         if (this.ModelState.IsValid)
         {
             var result = service.DeleteDesignation(aDesignationModel);
             if (result != null)
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, result));
             }
             else
             {
                 string message = "Not deleted successfully";
                 return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message));
             }
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
     }
 }
Esempio n. 2
0
 public Boolean Delete(Designation designation)
 {
     if (designation == null || !ModelState.IsValid)
     {
         throw new HttpException((int)HttpStatusCode.BadRequest, "Invalid Request");
     }
     designationService.DeleteDesignation(designation.DesignationId);
     return(true);
 }
Esempio n. 3
0
        //
        // GET: DeleteItem
        public ActionResult DeleteItem(string did)
        {
            Guid designationId;

            if (Guid.TryParse(did, out designationId))
            {
                designationService.DeleteDesignation(designationId);
            }

            List <Designation> designations = designationService.GetDesignations(countryProg.Id);

            return(View("ListView", designations));
        }
Esempio n. 4
0
        public JsonResult DeleteDesignation(Guid DesignationId)
        {
            bool flag = false;

            try
            {
                _DesignationServices.DeleteDesignation(DesignationId);
                flag = true;
            }
            catch (Exception ex)
            {
                flag = false;
            }
            return(Json(flag, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        public HttpResponseMessage Delete(int id)
        {
            HttpResponseMessage msg = Request.CreateResponse(HttpStatusCode.BadRequest, false);

            try
            {
                if (id > 0)
                {
                    var isSuccess = _designation.DeleteDesignation(id);
                    if (isSuccess)
                    {
                        msg = Request.CreateResponse(HttpStatusCode.OK, isSuccess);
                    }
                }

                return(msg);
            }
            catch (Exception ex)
            {
                return(msg);
            }
        }
 public bool DeleteDesignation(int id)
 {
     return(_designationService.DeleteDesignation(id));
 }