Ejemplo n.º 1
0
        public IHttpActionResult GetAll()

        {
            PayShiftsBL        objUser       = new PayShiftsBL();
            List <PayShiftsDC> objResultList = new List <PayShiftsDC>();

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

            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 postShifts([FromBody] PayShiftsDC payDepartment)
        {
            //List<EXCEPTIONDC> lstException = new List<EXCEPTIONDC>();
            try
            {
                var bl = new PayShiftsBL();

                PayShiftsBL objUser = new PayShiftsBL();
                PayShiftsDC oldObj  = new PayShiftsDC();
                //get Object before saving
                //oldObj = objUser.LoadByPrimaryKey(PayShiftsDC.Code);

                List <PayShiftsDC> list = new List <PayShiftsDC>();
                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);
            }
        }