public async Task <ActionResult> Create(MobileRepairViewModel model) { var mobileRepair = new MobileRepair() { CouponCode = model.CouponCode, Description = model.Description, MobileNumber = model.MobileNumber, ModelName = model.ModelName }; var otpResult = await _otpBusinessService.IsValidOtp(model.OTP, model.MobileNumber, (int)OtpReason.MobileRepair, DateTime.UtcNow); if (!otpResult.Succeeded) { return(this.Json(otpResult)); } if (!string.IsNullOrEmpty(model.CouponCode)) { var couponCodeResult = await _couponCodeBusinessService.IsValidCoupon(model.MobileNumber, model.CouponCode); if (!couponCodeResult.Succeeded) { return(this.Json(couponCodeResult)); } } var mobileRepairResult = await _mobileRepairBusinessService.Create(mobileRepair); return(this.JsonNet(mobileRepairResult)); }
public async Task <ActionResult> CreateMobileRepairPayment(MobileRepairViewModel model) { var otpResult = await _otpBusinessService.IsValidOtp(model.OTP, model.MobileNumber, (int)OtpReason.MobileRepairPayment, DateTime.UtcNow); if (!otpResult.Succeeded) { return(this.JsonNet(otpResult)); } var mobilePayment = new MobileRepairPayment { Amount = model.Amount, MobileRepairId = model.MobileRepairId, Otp = model.OTP, RecievedBy = User.Identity.GetUserId() }; var result = await _mobileRepairBusinessService.CreateMobileRepairPayment(mobilePayment); return(this.JsonNet(result)); }
public async Task <ActionResult> Edit(int mobileRepairId) { var id = UserPersonnelId; if (id == 0) { return(HttpForbidden()); } if (!await AuthorizationService.AuthorizeAsync((ClaimsPrincipal)User, id, Policies.Resource.MobileRepair.ToString())) { return(HttpForbidden()); } var mobileRepair = await _mobileRepairBusinessService.RetrieveMobileRepair(mobileRepairId); var model = new MobileRepairViewModel() { MobileRepair = mobileRepair }; return(View(model)); }
public async Task <ActionResult> Edit(MobileRepairViewModel model) { await _mobileRepairBusinessService.UpdateMobileRepair(model.MobileRepair); return(RedirectToAction("MobileRepairOrder")); }