public async Task PubblicaFascicolo(ATTI attoInDb, PubblicaFascicoloModel model, PersonaDto currentUser) { try { switch (model.Ordinamento) { case OrdinamentoEnum.Default: case OrdinamentoEnum.Presentazione: attoInDb.OrdinePresentazione = model.Abilita; attoInDb.LinkFascicoloPresentazione = string.Empty; break; case OrdinamentoEnum.Votazione: attoInDb.OrdineVotazione = model.Abilita; attoInDb.LinkFascicoloVotazione = string.Empty; break; default: throw new ArgumentOutOfRangeException(nameof(model.Ordinamento), model.Ordinamento, null); } attoInDb.UIDPersonaModifica = currentUser.UID_persona; attoInDb.DataModifica = DateTime.Now; await _unitOfWork.CompleteAsync(); } catch (Exception e) { Log.Error("Pubblica Fascicolo", e); throw; } }
public async Task <ActionResult> PubblicaFascicolo(PubblicaFascicoloModel model) { try { var apiGateway = new ApiGateway(_Token); await apiGateway.Atti.PubblicaFascicolo(model); return(Json("OK", JsonRequestBehavior.AllowGet)); } catch (Exception e) { Console.WriteLine(e); return(Json(new ErrorResponse(e.Message), JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> PubblicaFascicolo(PubblicaFascicoloModel model) { try { await ApiGateway.PubblicaFascicolo(model); return(Json("OK", JsonRequestBehavior.AllowGet)); } catch (Exception e) { Console.WriteLine(e); return(Json(new ErrorResponse { message = e.Message }, JsonRequestBehavior.AllowGet)); } }
public async Task PubblicaFascicolo(PubblicaFascicoloModel model) { try { var requestUrl = $"{apiUrl}/atti/abilita-fascicolazione"; var body = JsonConvert.SerializeObject(model); await Post(requestUrl, body, _token); } catch (UnauthorizedAccessException ex) { Log.Error("PubblicaFascicolo", ex); throw ex; } catch (Exception ex) { Log.Error("PubblicaFascicolo", ex); throw ex; } }
public async Task <IHttpActionResult> PubblicaFascicolo(PubblicaFascicoloModel model) { try { var attoInDb = await _logic.GetAtto(model.Id); if (attoInDb == null) { return(NotFound()); } var session = await GetSession(); var persona = await _logicPersone.GetPersona(session); await _logic.PubblicaFascicolo(attoInDb, model, persona); if (model.Abilita) { await _logicStampe.InserisciStampa(new BaseRequest <EmendamentiDto, StampaDto> { entity = new StampaDto { UIDAtto = model.Id, Da = 0, A = 0, Ordine = (int)model.Ordinamento }, ordine = model.Ordinamento }, persona); } return(Ok()); } catch (Exception e) { Log.Error("PubblicaFascicolo", e); return(ErrorHandler(e)); } }