Пример #1
0
        public IHttpActionResult PutFinanceItem(int id, FinanceItem financeItem)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            _context.Entry(financeItem).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public Property Add(Property property)
 {
     _db.Properties.Add(property);
     _db.SaveChanges();
     return(property);
 }