示例#1
0
        public IActionResult Edit(int id, [Bind("Id,EntryId,PlatformId,Description")] EntryPlatformListViewModel vwModel)
        {
            if (id != vwModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var dbModel = _mapper.Map <EntryPlatformModel>(vwModel);
                    _entryPlatformRepository.Update(dbModel);

                    ViewData["message"] = "Entry updated successfully.";
                }
                catch (Exception ex)
                {
                    // TODO ~ log something?
                    return(NotFound());
                }
            }

            SetSelectList();
            return(View(vwModel));
        }
示例#2
0
 public void Put(int id, [FromBody] EntryPlatformModel value)
 {
     value.Id = id;
     EntryPlatformRepository.Update(value);
 }