public async Task <ActionResult> CreateShopKeeper(SHOPKEEPER obj, HttpPostedFileBase ImageFile) { byte[] buf = new byte[ImageFile.ContentLength]; ShopkeeperImage shopkima = new ShopkeeperImage(); ImageFile.InputStream.Read(buf, 0, buf.Length); shopkima.image = buf; obj.userType = 1; obj.status = 1; obj.dateofBirth = DateTime.Now; obj.password = EncryptClass.getpassword(obj.password); shopkima.shopKeeperId = obj.Id; context.Shopkeeper.Add(obj); context.ShopkeeperImage.Add(shopkima); await context.SaveChangesAsync(); return(RedirectToAction("Login", "Home")); }
public async Task <ActionResult> CreateShop(Shop item1, List <int> item3, SHOPKEEPER item2, HttpPostedFileBase ImageFileOw, HttpPostedFileBase ImageFileShop) { ShopkeeperImage shopkima = new ShopkeeperImage(); ShopImage shopima = new ShopImage(); byte[] buf; if (ImageFileOw.ContentLength > 0) { buf = new byte[ImageFileOw.ContentLength]; ImageFileOw.InputStream.Read(buf, 0, buf.Length); shopkima.image = buf; } if (ImageFileShop.ContentLength > 0) { buf = new byte[ImageFileShop.ContentLength]; ImageFileShop.InputStream.Read(buf, 0, buf.Length); shopima.shopImage = buf; } item1.owner = item2.Id; item1.RegisteredDate = DateTime.Now; item2.password = EncryptClass.getpassword(item2.password); context.Shopkeeper.Add(item2); context.Shops.Add(item1); shopima.shopId = item1.ID; shopkima.shopKeeperId = item2.Id; foreach (int itemx in item3) { var ob = new Shop_Types { shopId = item1.ID, shopTypetId = itemx }; context.Shop_Types.Add(ob); } await context.SaveChangesAsync(); return(RedirectToAction("Login", "Home")); }