public IHttpActionResult GetAll() { PayDesignationBL objUser = new PayDesignationBL(); List <PayDesignationDC> objResultList = new List <PayDesignationDC>(); objResultList = objUser.LoadAll(); return(Ok(objResultList)); }
public IHttpActionResult Delete([FromBody] PayDesignationDC objUsers) { PayDesignationBL objUser = new PayDesignationBL(); List <EXCEPTIONDC> lstException = new List <EXCEPTIONDC>(); List <PayDesignationDC> list = new List <PayDesignationDC>(); list.Add(objUsers); try { int IsDeleted = objUser.Delete(list); return(Ok(IsDeleted)); } catch (Exception ex) { return(new TextResult(lstException, Request, "Following PayDesignations cannot be deleted as: ", "All the other records deleted successfully.", true)); } }
public IHttpActionResult postDesignation([FromBody] PayDesignationDC payDesignation) { //List<EXCEPTIONDC> lstException = new List<EXCEPTIONDC>(); try { var bl = new PayDesignationBL(); PayDesignationBL objUser = new PayDesignationBL(); PayDesignationDC oldObj = new PayDesignationDC(); //get Object before saving //oldObj = objUser.LoadByPrimaryKey(PayDesignationDC.Code); List <PayDesignationDC> list = new List <PayDesignationDC>(); list.Add(payDesignation); int UpdatedCount = 0; if (payDesignation.Code != null && payDesignation.Code.Length > 0) { UpdatedCount = bl.Update(list); } else { UpdatedCount = bl.Insert(list); } if (UpdatedCount > 0) { return(Ok(true)); } return(Ok(false)); } catch (Exception ex) { throw new Exception(ex.Message); //return new TextResult(lstException, Request); } }