예제 #1
0
        public VocalBase VocalEditForm(VocalEditForm newItem)
        {
            var o = ds.VocalDocs.Find(newItem.Id);

            if (o == null)
            {
                return(null);
            }

            ds.Entry(o).CurrentValues.SetValues(newItem);
            ds.SaveChanges();

            return(mapper.Map <VocalBase>(o));
        }
예제 #2
0
        public ActionResult Edit(int?id, VocalEditForm newItem)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("edit", new { id = newItem.Id }));
            }

            if (id.GetValueOrDefault() != newItem.Id)
            {
                return(RedirectToAction("index"));
            }

            var editedItem = m.VocalEditForm(newItem);

            if (editedItem == null)
            {
                return(RedirectToAction("edit", new { id = newItem.Id }));
            }
            else
            {
                return(RedirectToAction("details", new { id = newItem.Id }));
            }
        }