Exemplo n.º 1
0
        public async Task <ActionResult> Delete(Guid id, FormCollection collection)
        {
            Models.SecondaryObject model = null;
            try
            {
                var primaryObjectIdString = collection[nameof(Models.SecondaryObject.PrimaryObjectId)];
                model = new Models.SecondaryObject()
                {
                    Id              = id,
                    Description     = collection[nameof(Models.SecondaryObject.Description)],
                    Name            = collection[nameof(Models.SecondaryObject.Name)],
                    PrimaryObjectId = string.IsNullOrWhiteSpace(primaryObjectIdString) ? null : Guid.Parse(primaryObjectIdString) as Guid?,
                };
                await _secondaryObjectService.DeleteAsync(id);

                return(RedirectToAction("Edit", "PrimaryObjects", new { id = model.PrimaryObjectId }));
            }
            catch (Exception ex)
            {
                return(View(model));
            }
        }
 public async Task DeleteAsync(Guid id)
 {
     await _secondaryObjectService.DeleteAsync(id);
 }