public async Task <ActionResult> Create([FromBody] ShopModel model) { if (string.IsNullOrEmpty(model.Address) || string.IsNullOrEmpty(model.Name) || string.IsNullOrEmpty(model.Phone)) { return(BadRequest(new ResponseError() { ErrorCode = 400, Message = "Не заполнены все обязательные поля" })); } try { await _shopService.Create(model); return(Ok()); } catch (Exception ex) { return(BadRequest(new ResponseError() { ErrorCode = 400, Message = ex.Message })); } }
public async Task <ActionResult> AddMyShop(AddMyShopForm addMyShopForm) { if (!ModelState.IsValid) { return(View(addMyShopForm)); } var shop = addMyShopForm.ToShop(); shop.Town = _townService.GetById(addMyShopForm.TownId); shop.StatusId = StatusEnum.Pending; try { await _shopService.Create(shop, addMyShopForm.Email, AppSettings.Theme); await _notificationService.SendPendingShopEmail(shop.Name, addMyShopForm.Email, true, AppSettings.Theme); } catch (ApplicationException ex) { this.ModelState.AddModelError("", ex.Message); return(View(addMyShopForm)); } return(RedirectToAction("Index").WithSuccess("Su solicitud ha sido enviada correctamente")); }
public async Task <Guid> CreateAsync(ShopDto shop) { using (var uow = UnitOfWorkProvider.Create()) { shop.Id = _shopService.Create(shop); await uow.Commit(); return(shop.Id); } }
public async Task <IActionResult> Create(Shop shop) { if (!ModelState.IsValid) { return(View(shop)); } var exist = await _shopService.Exist(s => s.City.ToLower() == shop.City.ToLower() && s.Country.ToLower() == shop.Country.ToLower() && s.Name.ToLower() == shop.Name.ToLower() && s.PostalCode.ToLower() == shop.PostalCode.ToLower() && s.StreetAddress.ToLower() == shop.StreetAddress.ToLower()); if (exist) { ViewBag.Exist = true; return(View(shop)); } await _shopService.Create(shop); return(RedirectToAction(nameof(Index))); }
public async Task <ActionResult> Create(ShopForm shopForm) { if (!ModelState.IsValid) { return(View(shopForm)); } var shop = shopForm.ToShop(); try { shop.StatusId = StatusEnum.Approved; await _shopService.Create(shop, shopForm.Email, AppSettings.Theme); await _notificationService.SendAccountConfirmationEmail(shop.UserId, AppSettings.Theme); } catch (ApplicationException ex) { this.ModelState.AddModelError("", ex.Message); return(View(shopForm)); } return(RedirectToAction("Index", new ShopListFiltersModel().GetRouteValues()).WithSuccess("Comercio Creado")); }
public ActionResult ReplicateTheValues() { string procname = "TruncateTable"; _CompanyService.TruncateTable(procname); //Replicate The Bank Master Values var BankMasters = TempData["BankMasters"] as IEnumerable <BankMaster>; foreach (var Bank in BankMasters) { Bank.modifiedon = DateTime.Now; _BankService.CreateBank(Bank); } //Replicate The Client Master Values var ClientMasters = TempData["ClientMasters"] as IEnumerable <ClientMaster>; foreach (var Client in ClientMasters) { Client.ModifiedOn = DateTime.Now; _ClientMasterService.CreateClient(Client); } //Replicate The Client Bank Values var ClientBanks = TempData["ClientBanks"] as IEnumerable <ClientBankDetail>; foreach (var Bank in ClientBanks) { Bank.ModifiedOn = DateTime.Now; _ClientBankDetailService.CreateBankDetails(Bank); } //Replicate The Designation Master Values var DesignationMasters = TempData["DesignationMasters"] as IEnumerable <DesignationMaster>; foreach (var Designation in DesignationMasters) { Designation.ModifiedOn = DateTime.Now; _DesignationMasterService.Create(Designation); } //Replicate The Design Master Values var DesignMasters = TempData["DesignMasters"] as IEnumerable <DesignMaster>; foreach (var Design in DesignMasters) { Design.ModifiedOn = DateTime.Now; _DesignService.CreateDesign(Design); } //Replicate The Brand Master Values var BrandMasters = TempData["BrandMasters"] as IEnumerable <BrandMaster>; foreach (var Brand in BrandMasters) { Brand.ModifiedOn = DateTime.Now; _BrandMasterService.Create(Brand); } //Replicate The Employee Master Values var EmployeeMasters = TempData["EmployeeMasters"] as IEnumerable <EmployeeMaster>; foreach (var Employee in EmployeeMasters) { Employee.ModifiedOn = DateTime.Now; _EmployeeMasterService.CreateEmployee(Employee); } //Replicate The Godown Master Values var GodownMasters = TempData["GodownMasters"] as IEnumerable <GodownMaster>; foreach (var Godown in GodownMasters) { Godown.ModifiedOn = DateTime.Now; _GodownService.CreateGodown(Godown); } //Replicate The Godown Address Values var GodownAddresses = TempData["GodownAddresses"] as IEnumerable <GodownAddress>; foreach (var Address in GodownAddresses) { _GodownAddressService.CreateGoDown(Address); } //Replicate The Item Category Values var ItemCategory = TempData["ItemCategory"] as IEnumerable <ItemCategory>; foreach (var Category in ItemCategory) { Category.ModifiedOn = DateTime.Now; _ItemCategoryService.CreateItemCatgory(Category); } //Replicate The Item SubCategory Values var ItemSubCategory = TempData["ItemSubCategory"] as IEnumerable <ItemSubCategory>; foreach (var SubCategory in ItemSubCategory) { SubCategory.ModifiedOn = DateTime.Now; _ItemSubCategoryService.CreateItemCatgory(SubCategory); } //Replicate The Item Master Values var ItemMasters = TempData["ItemMasters"] as IEnumerable <Item>; foreach (var Item in ItemMasters) { Item.modifedOn = DateTime.Now; _ItemService.createItem(Item); } //Replicate The Non Inventory Item Values var NonInventoryItems = TempData["NonInventoryItems"] as IEnumerable <NonInventoryItem>; foreach (var NonInventoryItem in NonInventoryItems) { NonInventoryItem.modifedOn = DateTime.Now; _NonInventoryItemService.createNonInventoryItem(NonInventoryItem); } //Replicate The Barcode Numbers Values var Barcodes = TempData["BarcodeNumbers"] as IEnumerable <BarcodeNumber>; foreach (var Barcode in Barcodes) { _BarcodeNumberService.CreateBarcode(Barcode); } //Replicate The Job Worker Values var JobWorkers = TempData["JobWorkers"] as IEnumerable <JobWorker>; foreach (var JobWorker in JobWorkers) { JobWorker.ModifiedOn = DateTime.Now; _JobWorkerService.Create(JobWorker); } //Replicate The Job Worker Type Values var JobWorkerTypes = TempData["JobWorkerTypes"] as IEnumerable <JobWorkType>; foreach (var JobWorkerType in JobWorkerTypes) { JobWorkerType.ModifiedOn = DateTime.Now; _JobWorkTypeService.Create(JobWorkerType); } ////Replicate The Sales Incentives Values //var SalesIncentives = TempData["SalesIncentives"] as IEnumerable<SalesIncentiveMaster>; //foreach (var SalesIncentive in SalesIncentives) //{ // SalesIncentive.ModifiedOn = DateTime.Now; // _SalesIncentiveService.CreateSI(SalesIncentive); //} //Replicate The Shop Master Values var ShopMasters = TempData["ShopMasters"] as IEnumerable <ShopMaster>; foreach (var Shop in ShopMasters) { Shop.ModifiedOn = DateTime.Now; _ShopService.Create(Shop); } //Replicate The Type Of Material Values var TypeOfMaterials = TempData["TypeOfMaterials"] as IEnumerable <TypeOfMaterial>; foreach (var Material in TypeOfMaterials) { Material.ModifiedOn = DateTime.Now; _TypeOfMaterialService.AddTypeOfMaterial(Material); } //Replicate The Unit Master Values var UnitMasters = TempData["UnitMasters"] as IEnumerable <UnitMaster>; foreach (var Unit in UnitMasters) { Unit.modifiedOn = DateTime.Now; _UnitService.createunit(Unit); } //Replicate The Supplier Master Values var SupplierMasters = TempData["SupplierMasters"] as IEnumerable <SupplierMaster>; foreach (var Supplier in SupplierMasters) { Supplier.ModifiedOn = DateTime.Now; _SuppliersMasterService.CreateSupplier(Supplier); } //Replicate The Supplier Bank Values var SupplierBanks = TempData["SupplierBanks"] as IEnumerable <SupplierBankDetail>; foreach (var Bank in SupplierBanks) { Bank.ModifiedOn = DateTime.Now; _SupplierBankDetailService.CreateBankDetails(Bank); } //Replicate The Transport Master Values var TransportMasters = TempData["TransportMasters"] as IEnumerable <TransportMaster>; foreach (var Transport in TransportMasters) { Transport.ModifiedOn = DateTime.Now; _TransportService.CreateTransport(Transport); } //Replicate The Tranport Bank Values var TransportBanks = TempData["TransportBanks"] as IEnumerable <TransportBankDetail>; foreach (var Bank in TransportBanks) { Bank.ModifiedOn = DateTime.Now; _TransportBankDetailService.CreateBankDetails(Bank); } //Replicate The User Values var Users = TempData["Users"] as IEnumerable <User>; foreach (var User in Users) { User.ModifiedBy = DateTime.Now; _UserService.CreateUser(User); } //Replicate The Commission Master Values var CommissionMasters = TempData["CommissionMasters"] as IEnumerable <CommissionMaster>; foreach (var Commission in CommissionMasters) { Commission.ModifiedOn = DateTime.Now; _CommissionService.Create(Commission); } //Replicate The Module Values var Modules = TempData["Modules"] as IEnumerable <Module>; foreach (var module in Modules) { _ModuleService.CreateModule(module); } //Replicate The UserCredential Values var UserCredentials = TempData["UserCredentials"] as IEnumerable <UserCredential>; foreach (var usercredential in UserCredentials) { _UserCredentialService.CreateUserCredential(usercredential); } //Replicate The Employee Company Values var EmployeeCompanies = TempData["EmployeeCompanies"] as IEnumerable <EmployeesCompany>; foreach (var EmpComp in EmployeeCompanies) { _EmployeesCompanyService.Create(EmpComp); } //CompanyCode = "RetailManagement"; //CompanyName = "RetailManagement"; //DatabaseName = "RetailManagement"; CompanyCode = "A2ZRetail"; CompanyName = "A2ZRetail"; DatabaseName = "A2ZRetail"; return(RedirectToAction("ReplicationDone")); }
public IActionResult Post([FromBody] Shop listaShop) { return(Ok(_service.Create(listaShop))); }
public ActionResult Create(MainApplication mainapp) { var shopmaster = _shopService.GetLastShop(); int shopVal = 0; int length = 0; if (shopmaster != null) { shopVal = shopmaster.ShopId; shopVal = shopVal + 1; length = shopVal.ToString().Length; } else { shopVal = 1; length = 1; } string shopCode = _utilityService.getName("SH", length, shopVal); mainapp.ShopDetails.ShopCode = shopCode; mainapp.ShopDetails.Status = "Active"; mainapp.ShopDetails.ModifiedOn = DateTime.Now; _shopService.Create(mainapp.ShopDetails); //SAVE SHOP IN USERCREDENTIAL AND MODULES Module modulesdetails = new Module(); UserCredential usercredentialdetails = new UserCredential(); modulesdetails.ModuleName = mainapp.ShopDetails.ShopName; modulesdetails.ModuleRights = "Add"; modulesdetails.AssignRightsCode = shopCode; int LastRowPrimaryKey = _iIModuleService.GetLastRow().Id; int actualdashboardID = LastRowPrimaryKey + 1; modulesdetails.DashboardId = "D" + actualdashboardID; _iIModuleService.CreateModule(modulesdetails); var username = HttpContext.Session["UserName"].ToString(); var lastmodulerow = _iIModuleService.GetLastRow(); //IF SUPERADMIN CREATE THE SHOP THEN MAKE THE ENTRY FOR SUPERADMIN ONLY.. if (username == "SuperAdmin") { usercredentialdetails.ModuleId = lastmodulerow.Id; usercredentialdetails.Modules = mainapp.ShopDetails.ShopName; usercredentialdetails.ModuleRights = "Add"; usercredentialdetails.UseName = username; usercredentialdetails.Email = UserEmail; usercredentialdetails.Status = "add"; _IUserCredentialService.CreateUserCredential(usercredentialdetails); string query = "GetUsersEmail"; var list = _shopService.GetUserEmails(query); foreach (var data in list) { var userdetails = _IUserCredentialService.GetByEmail(data.Email); usercredentialdetails.ModuleId = lastmodulerow.Id; usercredentialdetails.Modules = mainapp.ShopDetails.ShopName; usercredentialdetails.ModuleRights = "Add"; usercredentialdetails.UseName = userdetails.UseName; usercredentialdetails.Email = data.Email; usercredentialdetails.Status = ""; usercredentialdetails.AssignRightsCode = shopCode; _IUserCredentialService.CreateUserCredential(usercredentialdetails); } } //IF ANY OTHER EMPLOYEE CREATE THE SHOP THEN MAKE THE ENTRY FOR SUPERADMIN + EMPLOYEE.. else { //IF EXCEPT SUPERADMIN ADD SHOP THEN IT WELL DISPLAY ALL EMPLOYEE IN USERCREDENTIAL string query = "GetUsersEmail"; var list = _shopService.GetUserEmails(query); foreach (var data in list) { var userdetails = _IUserCredentialService.GetByEmail(data.Email); usercredentialdetails.ModuleId = lastmodulerow.Id; usercredentialdetails.Modules = mainapp.ShopDetails.ShopName; usercredentialdetails.ModuleRights = "Add"; usercredentialdetails.UseName = userdetails.UseName; usercredentialdetails.Email = data.Email; usercredentialdetails.Status = ""; usercredentialdetails.AssignRightsCode = shopCode; _IUserCredentialService.CreateUserCredential(usercredentialdetails); } usercredentialdetails.AssignRightsCode = null; usercredentialdetails.Status = "add"; usercredentialdetails.UseName = "SuperAdmin"; usercredentialdetails.Email = "*****@*****.**"; _IUserCredentialService.CreateUserCredential(usercredentialdetails); } var lastrow = _shopService.GetLastShop(); var ShopId = Encode(lastrow.ShopId.ToString()); return(RedirectToAction("CreateDetails/" + ShopId, "Shop")); }
public IActionResult Create(Shop obj) { _shopService.Create(obj); return(RedirectToAction("Index")); }