public JsonResult GetCustomerByCardCode(string Code) { var customer = CustomerRepository.GetvwCustomerForInvoiceByCardCode(Code); if (customer != null) { var model = new CustomerJsonModel(); AutoMapper.Mapper.Map(customer, model); var data = new { id = model.Id, text = model.Phone + " - " + model.Name, name = model.Name, point = model.RemainingPoint, html = Helpers.Common.RenderPartialViewToString(this, "InfoForInvoice", model), }; return(Json(data, JsonRequestBehavior.AllowGet)); } return(Json("failed", JsonRequestBehavior.AllowGet)); }
public JsonResult GetCustomerById(int Id) { var customer = CustomerRepository.GetvwCustomerForInvoiceById(Id); if (customer != null) { var model = new CustomerJsonModel(); AutoMapper.Mapper.Map(customer, model); var data = new { id = customer.Id, text = customer.Phone + " - " + customer.Name, //type = "Customer", name = customer.Name, point = customer.RemainingPoint, html = Helpers.Common.RenderPartialViewToString(this, "InfoForInvoice", model), }; return(Json(data, JsonRequestBehavior.AllowGet)); } return(Json(null, JsonRequestBehavior.AllowGet)); }