public async Task <HttpResponseMessage> UpdatePredmet(PredmetiViewModel updateP) { try { PredmetiViewModel toBeUpdated = Mapper.Map <PredmetiViewModel>(await PredmetiService.Get(updateP.PredmetiId)); if (toBeUpdated == null) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Nije pronađen traženi predmet.")); } if (updateP.Ime_predmeta == null || updateP.PredmetiId == null) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Greška u unosu!")); } else { toBeUpdated.Ime_predmeta = updateP.Ime_predmeta; } var response = await PredmetiService.Update(Mapper.Map <IPredmetiDomainModel>(toBeUpdated)); return(Request.CreateResponse(HttpStatusCode.OK, response)); }catch (Exception e) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e)); } }
public PredmetiView() { try { vm = new PredmetiViewModel(); this.InitializeComponent(); } catch (Exception e) { Console.WriteLine(e); } }
public async Task <HttpResponseMessage> AddPredmet(PredmetiViewModel addObj) { try { addObj.PredmetiId = Guid.NewGuid(); var response = await PredmetiService.Add(Mapper.Map <IPredmetiDomainModel>(addObj)); return(Request.CreateResponse(HttpStatusCode.OK, response)); }catch (Exception e) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e)); } }
public PredmetiPage(int Klijent) { InitializeComponent(); KlijentId = Klijent; BindingContext = model = new PredmetiViewModel(KlijentId); }