public async Task <ActionResult> GetForKlijent([FromQuery] DateTime?datumOd = null, [FromQuery] DateTime?datumDo = null)
 {
     try
     {
         return(Ok(await _uplataService.Get(UserResolver.GetKlijentId(HttpContext.User), datumOd, datumDo)));
     }
     catch (Exception ex)
     {
         return(BadRequest(new ApiException(ex.Message, System.Net.HttpStatusCode.BadRequest)));
     }
 }
 public async Task <ActionResult> GetKlijentData()
 {
     try
     {
         return(Ok(await _klijentDataService.GetKlijentData(UserResolver.GetKlijentId(HttpContext.User))));
     }
     catch (Exception ex)
     {
         return(BadRequest(new ApiException(ex.Message, System.Net.HttpStatusCode.BadRequest)));
     }
 }
 public async Task <ActionResult> PrijaviSeZaKurs([FromBody] int instancaId)
 {
     try
     {
         return(Ok(await _kursInstancaDataService.PrijaviSeZaKurs(instancaId, UserResolver.GetKlijentId(HttpContext.User))));
     }
     catch (Exception ex)
     {
         return(BadRequest(new ApiException(ex.Message, System.Net.HttpStatusCode.BadRequest)));
     }
 }
 public async Task <ActionResult> UpdateKlijentData([FromBody] KlijentDataUpdateModel model)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(model));
         }
         return(Ok(await _klijentDataService.UpdateKlijentData(UserResolver.GetKlijentId(HttpContext.User), model)));
     }
     catch (Exception ex)
     {
         return(BadRequest(new ApiException(ex.Message, System.Net.HttpStatusCode.BadRequest)));
     }
 }
 public async Task <ActionResult> Get([FromQuery] KursInstancaDataFilter model)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             throw new Exception("Neispravna pretraga.");
         }
         return(Ok(await _kursInstancaDataService.GetInstance(UserResolver.GetKlijentId(HttpContext.User), model)));
     }
     catch (Exception ex)
     {
         return(BadRequest(new ApiException(ex.Message, System.Net.HttpStatusCode.BadRequest)));
     }
 }
 public async Task <ActionResult> OstaviRejting([FromBody] RejtingModel model)
 {
     try
     {
         if (model.Rejting < 1 || model.Rejting > 5)
         {
             ModelState.AddModelError(nameof(RejtingModel.Rejting), "Rejting može imati vrijednost od 1 do 5.");
         }
         if (!ModelState.IsValid)
         {
             return(BadRequest(model));
         }
         return(Ok(await _kursInstancaDataService.OstaviRejting(model, UserResolver.GetKlijentId(HttpContext.User))));
     }
     catch (Exception ex)
     {
         return(BadRequest(new ApiException(ex.Message, System.Net.HttpStatusCode.BadRequest)));
     }
 }