Ejemplo n.º 1
0
        public IHttpActionResult GetAll()

        {
            PayDepartmentBL        objUser       = new PayDepartmentBL();
            List <PayDepartmentDC> objResultList = new List <PayDepartmentDC>();

            objResultList = objUser.LoadAll();
            return(Ok(objResultList));
        }
Ejemplo n.º 2
0
        public IHttpActionResult Delete([FromBody] PayDepartmentDC objUsers)
        {
            PayDepartmentBL        objUser      = new PayDepartmentBL();
            List <EXCEPTIONDC>     lstException = new List <EXCEPTIONDC>();
            List <PayDepartmentDC> list         = new List <PayDepartmentDC>();

            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));
            }
        }
Ejemplo n.º 3
0
        public IHttpActionResult postDepartment([FromBody] PayDepartmentDC payDepartment)
        {
            //List<EXCEPTIONDC> lstException = new List<EXCEPTIONDC>();
            try
            {
                var bl = new PayDepartmentBL();

                PayDepartmentBL objUser = new PayDepartmentBL();
                PayDepartmentDC oldObj  = new PayDepartmentDC();
                //get Object before saving
                //oldObj = objUser.LoadByPrimaryKey(PayDepartmentDC.Code);

                List <PayDepartmentDC> list = new List <PayDepartmentDC>();
                list.Add(payDepartment);
                int UpdatedCount = 0;
                if (payDepartment.Code != null && payDepartment.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);
            }
        }