public IHttpActionResult SaveInquiryPosition([FromBody] object inquiryPosData) { WebResponseContentModel <InquiryPositionModel> model = null; try { model = JsonConvert.DeserializeObject <WebResponseContentModel <InquiryPositionModel> >(inquiryPosData.ToString()); if (model.Content != null) { if (model.Content.PovprasevanjePozicijaID > 0)//We update existing record in DB { inquiryRepo.SaveInquiryPositionModel(model.Content); } else // We add and save new recod to DB { model.Content.PovprasevanjePozicijaID = inquiryRepo.SaveInquiryPositionModel(model.Content, false); } model.Content.PovprasevanjePozicijaArtikel = inquiryRepo.GetInquiryPositionArtikelByInquiryPositionID(model.Content.PovprasevanjePozicijaID); //model = inquiryRepo.GetInquiryPositionByID(model.Content.PovprasevanjeID); model.IsRequestSuccesful = true; } else { model.IsRequestSuccesful = false; model.ValidationError = ValidationExceptionError.res_09; } } catch (Exception ex) { model.IsRequestSuccesful = false; model.ValidationError = ExceptionValidationHelper.GetExceptionSource(ex); return(Json(model)); } return(Json(model)); }