public HttpResponseMessage Put([FromBody] int id, [FromUri] Employee employee)
        {
            try
            {
                using (WebAPI_Tutorial_DatabaseEntities entities = new WebAPI_Tutorial_DatabaseEntities())
                {
                    var entity = entities.Employees.FirstOrDefault(e => e.ID == id);
                    if (entity == null)
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound, id + " not found"));
                    }
                    else
                    {
                        entity.First_Name = employee.First_Name;
                        entity.Last_Name  = employee.Last_Name;
                        entity.Gender     = employee.Gender;
                        entity.Salary     = employee.Salary;

                        entities.SaveChanges();
                        return(Request.CreateResponse(HttpStatusCode.OK));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
 public HttpResponseMessage Delete(int id)
 {
     try
     {
         using (WebAPI_Tutorial_DatabaseEntities entities = new WebAPI_Tutorial_DatabaseEntities())
         {
             var entity = entities.Employees.FirstOrDefault(e => e.ID == id);
             if (entity == null)
             {
                 return(Request.CreateErrorResponse(HttpStatusCode.NotFound, id + " not found"));
             }
             else
             {
                 entities.Employees.Remove(entity);
                 entities.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.OK));
             }
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
        public HttpResponseMessage Post([FromBody] Employee employee)
        {
            try
            {
                using (WebAPI_Tutorial_DatabaseEntities entities = new WebAPI_Tutorial_DatabaseEntities())
                {
                    entities.Employees.Add(employee);
                    entities.SaveChanges();

                    return(Request.CreateResponse(HttpStatusCode.Created, employee));

                    //var message = Request.CreateResponse(HttpStatusCode.Created, employee);

                    //-- nicher ai ta likhle path shoho fixed hoye jabe.. tutorial-7 (09:20)

                    //message.Headers.Location = new Uri(Request.RequestUri + "/" + employee.ID.ToString());
                    //return message;
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }