public async Task <bool> EditSellerProfile(SellerDetails seller) { Seller seller1 = _context.Seller.Find(seller.Sellerid); if (seller1 != null) { seller1.Username = seller.Username; seller1.Password = seller.Password; seller1.Gst = seller.Gst; seller1.Companyname = seller.Companyname; seller1.Aboutcmpy = seller.Aboutcmpy; seller1.Address = seller.Address; seller1.Website = seller.Website; seller1.Email = seller.Email; seller1.Mobileno = seller.Mobileno; _context.Seller.Update(seller1); var user = await _context.SaveChangesAsync(); if (user > 0) { return(true); } else { return(false); } } else { return(false); } }
private void SaveUser(SellerDetails seller) { var client = new HttpClient(); StringContent content = new StringContent(JsonConvert.SerializeObject(seller), Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync( $"api/user/", content).Result; response.EnsureSuccessStatusCode(); var invoiceResp = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); }
public Request() { SellerDetails = new SellerDetails(); BasicInformation = new BasicInformation(); BuyerDetails = new BuyerDetails(); GoodsDetails = new List <GoodsItem>(); TaxDetails = new List <TaxDetail>(); Summary = new Summary(); PayWay = new List <Payment>(); Extend = new Extend(); }
public async Task <IActionResult> ViewSellerProfile(int sellerid) { SellerDetails seller = await _iSellerManager.ViewSellerProfile(sellerid); if (seller == null) { return(Ok("Invalid User")); } else { return(Ok(seller)); } }
public async Task <SellerDetails> ViewSellerProfile(int sellerid) { SellerDetails seller = await _isellerRepository.ViewSellerProfile(sellerid); if (seller == null) { return(null); } else { return(seller); } }
public async Task <bool> EditSellerProfile(SellerDetails seller) { bool user = await _isellerRepository.EditSellerProfile(seller); if (user) { return(true); } else { return(false); } }
public async Task SellerProfile_UnSuccessfull(int sid) { try { SellerDetails seller = new SellerDetails(); var mock = new Mock <ISellerRepository>(); mock.Setup(x => x.ViewSellerProfile(sid)); SellerManager sellerManager = new SellerManager(mock.Object); var result = await sellerManager.ViewSellerProfile(sid); Assert.IsNull(result, "invalid seller"); } catch (Exception e) { Assert.Fail(e.Message); } }
public async Task SellerProfileSuccess(int sid) { try { SellerDetails seller = new SellerDetails(); var mock = new Mock <ISellerRepository>(); mock.Setup(x => x.ViewSellerProfile(sid)).ReturnsAsync(seller); SellerManager sellerManager = new SellerManager(mock.Object); var result = await sellerManager.ViewSellerProfile(sid); Assert.NotNull(result); } catch (Exception e) { Assert.Fail(e.Message); } }
public long UpdateSellerItemDetails(String id, SellerDetails sellerDetails) { int sellerItemID = 0; var sellerItemNew = _context.SellerItems.Find(id); if (sellerItemNew != null) { sellerItemNew.sellerID = sellerDetails.sellerID; sellerItemNew.servedFor = sellerDetails.servedFor; sellerItemNew.quantity = sellerDetails.quantity; sellerItemNew.price = sellerDetails.price; sellerItemNew.isAvailable = sellerDetails.isAvailable; sellerItemNew.itemID = sellerDetails.itemID; sellerItemID = _context.SaveChanges(); } return(sellerItemID); }
public async Task EditSellerProfile_UnSuccessfull() { try { SellerDetails seller = new SellerDetails() { Sellerid = 507, Username = "******", Password = "******", Companyname = "accenture", Gst = 78, Aboutcmpy = "good", Address = "mumbai", Website = "www.accenture.com", Email = "*****@*****.**", Mobileno = "9478654567" }; var mock = new Mock <ISellerRepository>(); mock.Setup(x => x.EditSellerProfile(seller)).ReturnsAsync(false); var result = await sellerRepository.EditSellerProfile(seller); Assert.AreEqual(false, result); } catch (Exception e) { Assert.Fail(e.Message); } }
public async Task EditSellerProfile_Successfull() { try { mockSellerManager.Setup(x => x.EditSellerProfile(It.IsAny <SellerDetails>())).ReturnsAsync(new bool()); SellerDetails seller = new SellerDetails() { Sellerid = 809, Username = "******", Password = "******", Companyname = "infosys", Gst = 47, Aboutcmpy = "gud", Address = "bangalore", Website = "www.infy.com", Email = "*****@*****.**", Mobileno = "9535678900" }; var result = await sellerController.EditSellerProfile(seller) as OkResult; Assert.That(result, Is.Not.Null); Assert.That(result.StatusCode, Is.EqualTo(200)); } catch (Exception e) { Assert.Fail(e.Message); } }
public void AddSellerItemDetails(SellerDetails sellerDetails) { SellerItem sellerItem = new SellerItem { sellerID = sellerDetails.sellerID, isAvailable = sellerDetails.isAvailable, price = sellerDetails.price, quantity = sellerDetails.quantity, servedFor = sellerDetails.servedFor, flatID = sellerDetails.flatID, itemID = Guid.NewGuid().ToString(), itemName = sellerDetails.itemName, itemDesc = sellerDetails.itemDesc, veg = sellerDetails.veg }; _context.SellerItems.Add(sellerItem); _context.SaveChanges(); }
public async Task <SellerDetails> ViewSellerProfile(int sid) { Seller seller = await _context.Seller.FindAsync(sid); if (seller == null) { return(null); } else { SellerDetails seller1 = new SellerDetails(); seller1.Username = seller.Username; seller1.Password = seller.Password; seller1.Gst = seller.Gst; seller1.Companyname = seller.Companyname; seller1.Aboutcmpy = seller.Aboutcmpy; seller1.Address = seller.Address; seller1.Website = seller.Website; seller1.Email = seller.Email; seller1.Mobileno = seller.Mobileno; return(seller1); } }
public async Task <IActionResult> EditSellerProfile(SellerDetails seller) { return(Ok(await _iSellerManager.EditSellerProfile(seller))); }
public void Post([FromBody] SellerDetails sellerFlat) { manager.AddSellerItemDetails(sellerFlat); }
public void Put(String id, [FromBody] SellerDetails sellerDetails) { manager.UpdateSellerItemDetails(id, sellerDetails); }