//When a view is returned, it expects that an associated .cshtml file is in the same view folder //structure as the controller layout for that area (if no areas are in use, then there is only //1 view folder and 1 controller folder). The controller name will be the folder name in the views //folder, and the actionresult name will be the expected name of the .cshtml file. //[NopHttpsRequirement(SslRequirement.No)] //public ActionResult Index() //{ // return View(); //} public ActionResult CreateUpdateConsignor(int ConsignorId = 0) { AUConsignorRecord consignor = new AUConsignorRecord(); if (ConsignorId > 0) { consignor = _consignorRepo.GetById(ConsignorId); } //indicate if entity has a fee associated. This tells Consignor page not to show fees fields if already has fee (maintain through grid) var fee = _consignorService.GetFeesForOneId(ConsignorId, "AUConsignor"); //return View(consignment); //use with custome view engine //return View("CreateUpdatePromoSlider"); //return View("~/Views/PromoSlider/CreateUpdatePromoSlider.cshtml"); return View("~/Views/AUConsignor/CreateUpdateConsignor.cshtml", consignor); //worked first time null //return View("~/Plugins/Widgets.PromoSlider/Views/PromoSlider/CreateUpdatePromoSlider.cshtml", slider); }
public ActionResult CreateUpdateConsignor(AUConsignorRecord record) { if (ModelState.IsValid) { AUConsignorRecord consignor = _consignorRepo.GetById(record.AUConsignorID); if (consignor == null) { var CurrentCustomer = _authenticationService.GetAuthenticatedCustomer(); record.CreatedBy = CurrentCustomer.Username; record.UpdatedBy = CurrentCustomer.Username; record.CreatedOnDT = System.DateTime.UtcNow; record.UpdatedOnDT = System.DateTime.UtcNow; //Make updated by same as created by date for initial store //record.UpdatedOnDT = System.DateTime.UtcNow; record.UpdatedOnDT = record.CreatedOnDT; _consignorRepo.Insert(record); //store a blank fee at the highest level to make consignor fees easier/more consistent grid design var fee = new AUFeesRecord(); fee.AUEntityID = record.AUConsignorID; fee.AUEntityType = "AUConsignor"; fee.CommissionCanExceedReserveInd = false; fee.ExpertisingFeeAmt = 0; fee.FixedFeeAmt = 0; fee.InsuranceSoldPct = 0; fee.InsuranceUnsoldPct = 0; fee.InterestOnAdvancePct = 0; fee.MinCommissionMailSoldAmt = 0; fee.MinCommissionMailUnsoldAmt = 0; fee.MinCommissionPublicSoldAmt = 0; fee.MinCommissionPublicUnsoldAmt = 0; fee.MinimumConsignorTotalFeeAmt = 0; fee.MiscFeeAmt = 0; fee.SoldPct = 0; fee.UnsoldPct = 0; _feesRepo.Insert(fee); SuccessNotification("Consignor Created Successfully - please add consignments and fees!"); return RedirectToRoute(new { Action = "CreateUpdateConsignor", Controller = "AUConsignor", ConsignorId = record.AUConsignorID }); } else { //use latest consignor record to update with most up-do-date data rather than stale record consignor.Prefix = record.Prefix; consignor.FirstName = record.FirstName; consignor.MiddleName = record.MiddleName; consignor.LastName = record.LastName; consignor.CustomerID = record.CustomerID; consignor.Suffix = record.Suffix; consignor.WEMailID = record.WEMailID; consignor.HEMailID = record.HEMailID; consignor.EMailPrefCode = record.EMailPrefCode; //consignor.CommissionCanExceedReserveInd = record.CommissionCanExceedReserveInd; //consignor.SoldPct = record.SoldPct; //consignor.UnsoldPct = record.UnsoldPct; //consignor.InsuranceSoldPct = record.InsuranceSoldPct; //consignor.InsuranceUnsoldPct = record.InsuranceUnsoldPct; //consignor.MinCommissionPublicSoldAmt = record.MinCommissionPublicSoldAmt; //consignor.MinCommissionPublicUnsoldAmt = record.MinCommissionPublicUnsoldAmt; //consignor.MinCommissionMailSoldAmt = record.MinCommissionMailSoldAmt; //consignor.MinCommissionMailUnsoldAmt = record.MinCommissionMailUnsoldAmt; //consignor.FixedFeeAmt = record.FixedFeeAmt; //consignor.MinimumConsignorTotalFeeAmt = record.MinimumConsignorTotalFeeAmt; //consignor.InterestOnAdvancePct = record.InterestOnAdvancePct; //consignor.MiscFeeAmt = record.MiscFeeAmt; //consignor.MiscFeeAmt = record.MiscFeeAmt; //consignor.MiscFeeType = record.MiscFeeType; //consignor.ExpertisingFeeAmt = record.ExpertisingFeeAmt; //consignor.CreatedOnDT = System.DateTime.UtcNow; --> don't overlay created info //consignor.CreatedBy = CurrentCustomer.Username; var CurrentCustomer = _authenticationService.GetAuthenticatedCustomer(); consignor.UpdatedBy = CurrentCustomer.Username; consignor.UpdatedOnDT = System.DateTime.UtcNow; //this is how nop converts it back out //consignor.CreatedOnDT = _dateTimeHelper.ConvertToUserTime(customer.CreatedOnUtc, DateTimeKind.Utc); //public virtual DateTime CreatedOnDT { get; set; } //public virtual string CreatedBy { get; set; } //public virtual DateTime UpdatedOnDT { get; set; } //public virtual string UpdatedBy { get; set; } _consignorRepo.Update(consignor); _cacheManager.Clear(); SuccessNotification("Changed Saved!"); //return View(consignment); //now with customer view engine return View("~/Views/AUConsignor/CreateUpdateConsignor.cshtml", consignor); //not hit first time?? //return View("~/Plugins/Widgets.PromoSlider/Views/PromoSlider/CreateUpdatePromoSlider.cshtml", slider); } } else { return View(); //return View("~/Views/PromoSlider/CreateUpdatePromoSlider.cshtml"); //not hit first time? //return View("~/Plugins/Widgets.PromoSlider/Views/PromoSlider/CreateUpdatePromoSlider.cshtml"); } }
public ActionResult EditCustomer(int ConsignorId = 0) { AUConsignorRecord consignor = new AUConsignorRecord() { FirstName = "Test" }; if (ConsignorId > 0) { consignor = _consignorRepo.GetById(ConsignorId); } //try this!! COMMENTED 03/23/16 TO AVOID THE WHOL INHERITANCE BULLSHIT //return RedirectToAction("Edit", "AUConsignorAdmin", new { id = consignor.CustomerID, area = "Admin" }); return RedirectToAction("Edit", "Customer", new { id = consignor.CustomerID, area = "Admin" }); //comment for now //if (!ControllerContext.IsChildAction) //%%%%% //{ return View(consignor); } //else //{ return PartialView(consignor); } }