List<Customer> n = (from c in db.Customers where c.IsDeleted == false select c).ToList();
var objCusCreatedDate=n[i].CreatedDate;
var objNextDate = objCusCreatedDate.GetValueOrDefault().AddDays(120);
var salescount = (from sc in db.SalesOrders where sc.CustomerID==objCustomerID && sc.CreatedDate >= objCusCreatedDate && sc.CreatedDate<= objNextDate select sc.SalesOrderID).Count();
if (salescount <= 3&& salescount> 0)
{
customertype = "Exisiting Customer";
}
else if (salescount >= 3)
{
customertype = "Potential Customer";
}
else
{
customertype = "New Customer";
}
//var details = (from c in db.Customers where c.IsDeleted == false select c);
}
return View();
}
Wanted Output
I want to create a view same as like which is mentioned in the above image. First i want to list all the Customer Name (which is from Customer table)
Customer Table
CustomerID uniqueidentifier primarykey not null,
DisplayName varchar(100) null
then i want to create one column manually in view Customer Type. The value for Customer Type have to get it from Controller(customertype = "Potential Customer";)
Eg
Customer Name | Customer Type |
TBS Sizing Mill | Existing Customer |
Kallam Spinning Mill | Potential Customer |
Suryaprabha Sizing | New Customer |
Skyweaves | Existing Customer |
How i do this this is my task. please i did the controller part . please any one help me to do this task..
My Model
public class CustomerTypeViewModel
{
public System.Guid CustomerID { get; set; }
public string CustomerName { get; set; }
public DateTime CreatedDate { get; set; }
public string SalesCount { get; set; }
public string CustomerType { get; set; }
}