public IHttpActionResult PutPersonal_details(string id, Personal_details personal_details)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != personal_details.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IHttpActionResult PutEmployee(string id, Employee employee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != employee.ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public string Post([FromBody] user p)
        {
            db.users.Add(p);
            var res = db.SaveChanges();

            if (res > 0)
            {
                return("New User Inserted");
            }
            else
            {
                return("Error Inserting User");
            }
        }
Exemplo n.º 4
0
        public string Post([FromBody] book p)
        {
            db.books.Add(p);
            var res = db.SaveChanges();

            if (res > 0)
            {
                return("New Book Inserted");
            }
            else
            {
                return("Error Inserting Book");
            }
        }
Exemplo n.º 5
0
        public string Post([FromBody] bookissue p)
        {
            p.expreturndate = (Convert.ToDateTime(p.issuedate).AddDays(p.noofdays)).ToString();
            db.bookissues.Add(p);
            var res = db.SaveChanges();

            if (res > 0)
            {
                return("New Book issue");
            }
            else
            {
                return("Error In Issue");
            }
        }