public static GanhoExtraApi ToApi(this GanhoExtra model)
 {
     return(new GanhoExtraApi
     {
         Id = model.Id,
         DataRecebimento = Convert.ToString(model.DataRecebimento),
         Valor = model.Valor,
         CompetenciaId = model.CompetenciaId,
     });
 }
 public ActionResult Edit([FromForm] GanhoExtra model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _ganhoExtraRepository.Edit(model);
             return(RedirectToAction(nameof(Index)));
         }
     }
     catch
     {
         RedirectToAction(nameof(Index));
     }
     return(RedirectToAction(nameof(Index)));
 }
 public ActionResult Create([FromForm] GanhoExtra model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _ganhoExtraRepository.Insert(model);
             return(RedirectToAction(nameof(Index)));
         }
         catch (AggregateException ae) when(ae.InnerException != null && ae.InnerException is HttpRequestException)
         {
             ViewBag.ErrorMessage = ae.InnerException.Message;
         }
     }
     return(View());
 }
        public ActionResult Create()
        {
            var ganhosExtra = new GanhoExtra();

            return(View(ganhosExtra));
        }
 public void Insert(GanhoExtra model)
 {
     _ = ApiCaller.CallWebApiByPost <GanhoExtra>(Token, model, $"{ControllerName}").Result;
 }