Example #1
0
        public IHttpActionResult PostHRM_MASTER(HRM_MASTER hRM_MASTER)
        {
            //if (!ModelState.IsValid)
            //{
            //    return BadRequest(ModelState);
            //}

            db.HRM_MASTER.Add(hRM_MASTER);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (HRM_MASTERExists(hRM_MASTER.USER_CODE))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = hRM_MASTER.USER_CODE }, hRM_MASTER));
        }
Example #2
0
        public IHttpActionResult PutHRM_MASTER(decimal id, HRM_MASTER hRM_MASTER)
        {
            //if (!ModelState.IsValid)
            //{
            //    return BadRequest(ModelState);
            //}

            if (id != hRM_MASTER.USER_CODE)
            {
                return(BadRequest());
            }

            db.Entry(hRM_MASTER).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HRM_MASTERExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #3
0
        public IHttpActionResult GetHRM_MASTER(decimal id)
        {
            HRM_MASTER hRM_MASTER = db.HRM_MASTER.Find(id);

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

            return(Ok(hRM_MASTER));
        }
Example #4
0
        public IHttpActionResult DeleteHRM_MASTER(decimal id)
        {
            HRM_MASTER hRM_MASTER = db.HRM_MASTER.Find(id);

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

            db.HRM_MASTER.Remove(hRM_MASTER);
            db.SaveChanges();

            return(Ok(hRM_MASTER));
        }