public IHttpActionResult PutMandateModel(string id, Mandate mandateModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //if (id != mandateModel.IdResource)
            //{
            //    return BadRequest();
            //}

            sm.UpdateMandate(mandateModel);

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
        public ActionResult Edit([Bind(Include = "IdResource,IdProject,MandateId,StartDate,EndDate,Fees")] MandateModel mandateModel)
        {
            if (ModelState.IsValid)
            {
                var m = mandates.Where(e => e.MandateId == mandateModel.MandateId).FirstOrDefault();


                m.EndDate    = mandateModel.EndDate;
                m.Fees       = mandateModel.Fees;
                m.IdProject  = mandateModel.IdProject;
                m.IdResource = mandateModel.IdResource;
                m.StartDate  = mandateModel.StartDate;

                s.UpdateMandate(m);
                s.Commit();
                return(RedirectToAction("Index"));
            }
            //ViewBag.IdMandateHistory = new SelectList(db.MandateHistoryModels, "IdMandateHistory", "IdMandateHistory", mandateModel.IdMandateHistory);
            return(View(mandateModel));
        }