public void TestDeleteProductModel() { ContextSeeder.Seed(); var bo = new ProductModelBusinessObject(); var resList = bo.List(); var resDelete = bo.Delete(resList.Result.First().Id); var resNotList = bo.List().Result.Where(x => !x.IsDeleted).ToList(); Assert.IsTrue(resDelete.Success && resNotList.Count == 0); }
public void TestListProductModel() { ContextSeeder.Seed(); var bo = new ProductModelBusinessObject(); var resList = bo.List(); Assert.IsTrue(resList.Success && resList.Result.Count == 1); }
public void TestUpdateProductModel() { ContextSeeder.Seed(); var bo = new ProductModelBusinessObject(); var resList = bo.List(); var item = resList.Result.FirstOrDefault(); item.Name = "It's just wine"; var resUpdate = bo.Update(item); var resNotList = bo.ListNotDeleted().Result; Assert.IsTrue(resUpdate.Success && resNotList.First().Name == "It's just wine"); }
public ActionResult <List <ProductModelViewModel> > List() { var res = _bo.List(); if (!res.Success) { return(StatusCode((int)HttpStatusCode.InternalServerError)); } var list = new List <ProductModelViewModel>(); foreach (var item in res.Result) { list.Add(new ProductModelViewModel { Id = item.Id, Name = item.Name, BarCode = item.BarCode, Description = item.Description, Price = item.Price.ToString(), Amount = item.Amount.ToString(), Measure = item.Measure, BrandId = item.BrandId, CategoryId = item.CategoryId }); } return(list); }