public IMessageProvider Create() { var serialNo = SerialNoHelper.Create(); var roles = MembershipService.QueryRoles(new RoleRequest { Name = RoleNames.ShopOwner }).ToList(); TransactionHelper.BeginTransaction(); OnSave(InnerObject, Owner); Owner.SetPassword(Password); InnerObject.State = States.Normal; InnerObject.RechargeAmount = RechargeAmount; Owner.State = States.Normal; ShopService.Create(InnerObject); Owner.ShopId = InnerObject.ShopId; MembershipService.CreateUser(Owner); MembershipService.AssignRoles(Owner, roles.Select(x => x.RoleId).ToArray()); ShopDealLog log = new ShopDealLog(serialNo, DealTypes.Open, 0, null, null, null, InnerObject, 0); ShopDealLogService.Create(log); AddMessage("success", ShopName); Logger.LogWithSerialNo(LogTypes.ShopCreate, serialNo, InnerObject.ShopId, ShopName); CacheService.Refresh(CacheKeys.PosKey); return(TransactionHelper.CommitAndReturn(this)); }
private void AddShop_Click(object sender, RoutedEventArgs e) { // Input validation string error = ""; if (ChainDropdown.SelectedIndex < 0) { error += "Select a chain\n"; } if (StreetTextbox.Text == "") { error += "Fill in a street\n"; } if (NumberTextbox.Text == "") { error += "Fill in a house number\n"; } if (ZipTextbox.Text == "") { error += "Fill in a zipcode\n"; } if (CityTextbox.Text == "") { error += "Fill in a city"; } if (error != "") { MessageBox.Show(error); } else { ShopService shopService = new ShopService(); try { // Create Shop shopService.Create(new ShopDto { Street = StreetTextbox.Text, Number = NumberTextbox.Text, Zipcode = ZipTextbox.Text, City = CityTextbox.Text, Chain_id = (int)ChainDropdown.SelectedValue }); MessageBox.Show("Shop added"); // Reset form ChainDropdown.SelectedIndex = -1; StreetTextbox.Text = ""; NumberTextbox.Text = ""; ZipTextbox.Text = ""; CityTextbox.Text = ""; } catch { MessageBox.Show("Failed to add shop"); } } }
public async Task create_should_invoke_create_on_repository() { var shopRepositoryMock = new Mock <IShopRepository>(); var shop = new Mock <Shop>(); var mapper = new Mock <IMapper>(); var shopService = new ShopService(shopRepositoryMock.Object, mapper.Object); await shopService.Create(shop.Object); shopRepositoryMock.Verify(x => x.Create(It.IsAny <Shop>()), Times.Once); }
public ActionResult Create([Bind(Include = "shno,empno,shthepic,shname,shclassno,shaccount,shpwd,shboss,shcontact,shaddress,shtel,shemail,shabout,shlogopic,shurl,shadstate,shadtitle,shadpic,shpopshop,shcheckstate,shstartdate,shenddate,shcheckdate,shpwdstate,shstoprightstartdate,shstoprightenddate,shopguid")] SHOP sHOP) { if (ModelState.IsValid) { Service.Create(sHOP); return(RedirectToAction("Index")); } ViewBag.empno = new SelectList(EmpService.Get(), "empno", "empname", sHOP.empno); ViewBag.shclassno = new SelectList(ShClassService.Get(), "shclassno", "shclassname", sHOP.shclassno); return(View(sHOP)); }
public ActionResult <Shop> Create(Shop shop) { _shopService.Create(shop); return(CreatedAtRoute("GetShop", new { id = shop.Id.ToString() }, shop)); }
public ActionResult <string> Register([FromForm] Shop shop) { _shopService.Create(shop); return("Shop added Successfully"); }