public ICommandResult Execute(DeleteEstadoCalendarioCommand command) { var EstadoCalendario = EstadoCalendarioRepository.GetById(command.Id); EstadoCalendarioRepository.Delete(EstadoCalendario); unitOfWork.Commit(); return(new CommandResult(true)); }
public HttpResponseMessage Get([FromUri] short Id, [FromUri] string cultura, [FromUri] string[] include, [FromUri] bool indent = false) { try { var formatter = new MaxDepthJsonMediaTypeFormatter() { Indent = indent }; if (include.Length > 0) { formatter.SerializerSettings.MaxDepth = 100; //include.Max<string>(s => s.Split('.').Length * 5); formatter.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects; } else { formatter.SerializerSettings.MaxDepth = 1; } EstadoCalendario _estadocalendario = estadocalendarioRepository.GetById(include, (p => p.Id == Id)); if (cultura != Localizacion.CulturaPorDefecto) { EstadoCalendario_Idioma _estadocalendarioIdioma = estadocalendario_IdiomaRepository.GetMany(p => p.IdRegistro == Id && p.Cultura == cultura).FirstOrDefault(); // Campos multiidioma if (_estadocalendarioIdioma != null) { _estadocalendario.Nombre = _estadocalendarioIdioma.Nombre; } } if (_estadocalendario == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(Request.CreateResponse <EstadoCalendario>(HttpStatusCode.OK, _estadocalendario, formatter)); } catch (Exception _excepcion) { log.Error(_excepcion); return(Request.CreateResponse(HttpStatusCode.InternalServerError, _excepcion)); } }