コード例 #1
0
 public IHttpActionResult Post(CustomersBranches entity)
 {
     try
     {
         db.CustomersBranches.Add(entity);
         db.SaveChanges();
         return(Ok(entity));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
コード例 #2
0
 public IHttpActionResult Put(CustomersBranches entity)
 {
     try
     {
         db.CustomersBranches.Attach(entity);
         db.Entry(entity).State = EntityState.Modified;
         db.SaveChanges();
         return(Ok(entity));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }