internal ResultAction Get() { List <Supplier> suppliers = new SupplierService().Get(); ResultAction result = new ResultAction(); if (suppliers.Any()) { result.IsOk = true; result.Result = suppliers .Select(x => new SupplierDTO { Id = x.Id, CpfCnpj = x.CpfCnpj, Email = x.Email, Name = x.Name, PhoneNumber = x.PhoneNumber }) .ToList(); } else { result.Message = "Nenhum fornecedor encontrado."; } return(result); }
public ActionResult Add(Supplier data) { if (_supplierService.Any(supplier => supplier.TaxNumber == data.TaxNumber)) { return(RedirectToAction("List", "Supplier", new { area = "Member" })); } _supplierService.Add(data); return(RedirectToAction("List", "Supplier", new { area = "Member" })); }