Example #1
0
        public TrackBase TrackEditInfo(TrackEditInfo editItem)
        {
            var o = ds.Tracks.FirstOrDefault(t => t.Id == editItem.Id);

            if (o == null)
            {
                return(null);
            }
            else
            {
                ds.Entry(o).CurrentValues.SetValues(editItem);
                ds.SaveChanges();
            }
            return(mapper.Map <Track, TrackBase>(o));
        }
Example #2
0
        public ActionResult Edit(int?id, TrackEditInfo editItem)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Edit", new { id = editItem.Id }));
            }

            if (id.GetValueOrDefault() != editItem.Id)
            {
                RedirectToAction("Index");
            }

            var editedItem = m.TrackEditInfo(editItem);

            if (editedItem == null)
            {
                return(RedirectToAction("Edit", new { id = editItem.Id }));
            }
            else
            {
                return(RedirectToAction("Details", new { id = editItem.Id }));
            }
        }