public ActionResult Update(Referal referal) { ApiResult <Referal> apiResult; if (ModelState.IsValid) { if (referal.Id > 0) { apiResult = TryExecute(() => { _referalRepository.Update(referal); _unitOfWork.Commit(); return(referal); }, "Referal updated sucessfully"); } else { apiResult = TryExecute(() => { _referalRepository.Create(referal); _unitOfWork.Commit(); return(referal); }, "Referal created sucessfully"); } } else { apiResult = ApiResultFromModelErrors <Referal>(); } return(Json(apiResult, JsonRequestBehavior.AllowGet)); }
public void ReferalTest() { Hospital hospital = provider.GetItem <Hospital>(new HospitalDataFilter()); Assert.IsNotNull(hospital); var random = new Random(DateTime.Now.Millisecond); int suffix = random.Next(); Referal entity = new Referal() { FullName = "Test referal " + suffix, HospitalId = hospital.Id, Email = "*****@*****.**", Phone = "777", WorkPlace = "home" }; string updatedName = "Updaded " + entity.FullName; EntityTest <Referal>(entity, new ReferalDataFilter(), e => { return(new ReferalDataFilter() { Id = e.Id }); }, e => { e.FullName = updatedName; }, e => { return(updatedName.Equals(e.FullName)); }); }
//For BZ New Website public DataSet GetUserDetailBZFarmer(Referal objAppWebLogin) { using (var objcmd = objDB.GetStoredProcCommand(Constant.usp_BzFarmerAppWebLogin, Convert.ToDecimal(objAppWebLogin.MobileNumber), objAppWebLogin.Email, objAppWebLogin.RandomCode, objAppWebLogin.BzShareUrl, objAppWebLogin.ReferdBy, objAppWebLogin.FarmerID, objAppWebLogin.DeviceId, objAppWebLogin.FirstName)) { var dataset = objDB.ExecuteDataSet(objcmd); return(dataset); } }
public ActionResult Create(Referal referal) { if (ModelState.IsValid) { _referalRepository.Create(referal); _unitOfWork.Commit(); return(RedirectToAction("Index")); } ViewBag.JobOpeningId = new SelectList(_jobOpeningRepository.GetAll(), "Id", "Title", referal.JobOpeningId); return(View(referal)); }
public void PatientTest() { Hospital hospital = provider.GetItem <Hospital>(new HospitalDataFilter()); Assert.IsNotNull(hospital); var random = new Random(DateTime.Now.Millisecond); int suffix = random.Next(); Patient entity = new Patient() { FullName = "Test patient " + suffix, HospitalId = hospital.Id, Email = "*****@*****.**", Phone = "777", Address = "home", BirthDate = DateTime.Now.AddYears(-40), SourceType = "Прочее" }; string updatedName = "Updaded " + entity.FullName; Referal referal = provider.GetItem <Referal>(new ReferalDataFilter()); Assert.IsNotNull(referal); EntityTest <Patient>(entity, new PatientDataFilter(), e => { return(new PatientDataFilter() { Id = e.Id }); }, e => { e.FullName = updatedName; e.SourceType = "Реферал"; e.ReferalId = referal.Id; }, e => { return(updatedName.Equals(e.FullName) && "Реферал".Equals(e.SourceType) && e.ReferalId.HasValue && referal.Id == e.ReferalId.Value); }); }
public ActionResult DeleteReferal([DataSourceRequest] DataSourceRequest request, Referal referal) { if (referal != null) { DataProvider.Delete(referal); } return(Json(new[] { referal }.ToDataSourceResult(request, ModelState))); }
public ActionResult AddReferal([DataSourceRequest] DataSourceRequest request, Referal referal) { if (referal != null && ModelState.IsValid) { DataProvider.Add(referal); } return(Json(new[] { referal }.ToDataSourceResult(request, ModelState))); }