public ActionResult Edit([Bind(Include = "SummaryId,SummaryName,LastModificationDate,PeriodId")] SummaryModel summaryModel)
        {
            if (ModelState.IsValid)
            {
                summaryModel.LastModificationDate = DateTime.Now;
                db.Summary.Attach(summaryModel);
                db.Entry(summaryModel).Property(x => x.SummaryName).IsModified          = true;
                db.Entry(summaryModel).Property(x => x.LastModificationDate).IsModified = true;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            ViewBag.PeriodId = new SelectList(db.Period, "PeriodId", "PeriodName", summaryModel.PeriodId);
            return(View(summaryModel));
        }
Example #2
0
        public IHttpActionResult PutBook(int id, Book book)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "ListItemId,ItemName,PriorityId,Amount")] ListItemModel listItemModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(listItemModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PriorityId = new SelectList(db.Priority, "PriorityId", "Description", listItemModel.PriorityId);
     return(View(listItemModel));
 }
Example #4
0
        public ActionResult Edit([Bind(Include = "ConceptId,ConceptName,EsEgreso,Amount,Payd,Prepayment,AmountPayable,PayDate,CreationDate,LastModificationDate,SummaryId")] ConceptModel conceptModel)
        {
            if (ModelState.IsValid)
            {
                db.Entry(conceptModel).State = EntityState.Modified;
                db.SaveChanges();

                concepts.UpdateAmountsSummary(conceptModel);

                return(RedirectToAction("Index", new { SummaryId = conceptModel.SummaryId }));
            }
            ViewBag.SummaryId = new SelectList(db.Summary, "SummaryId", "SummaryName", conceptModel.SummaryId);
            return(View(conceptModel));
        }