public async Task <IHttpActionResult> Update(int leave_RequestID, [FromBody] Leave_Request leave_Request)
        {
            if (leave_Request.Id != leave_RequestID)
            {
                return(BadRequest("Id mismatch"));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            using (var db = new ApplicationDbContext())
            {
                db.Entry(leave_Request).State = EntityState.Modified;

                try
                {
                    await db.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException ducEx)
                {
                    bool exists = db.Leave_Request.Count(o => o.Id == leave_RequestID) > 0;
                    if (!exists)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw ducEx;
                    }
                }

                return(Ok(leave_Request));
            }
        }
        public async Task <IHttpActionResult> Insert([FromBody] Leave_Request leave_Request)
        {
            if (leave_Request.Id != 0)
            {
                return(BadRequest("Invalid Id"));
            }

            using (var db = new ApplicationDbContext())
            {
                db.Leave_Request.Add(leave_Request);
                await db.SaveChangesAsync();
            }

            return(Ok(leave_Request));
        }