private List <SelectListItem> GetVendorName() { MTSHRDataLayer.Vendors data_Ass = new MTSHRDataLayer.Vendors(); List <SelectListItem> Assetlist = new List <SelectListItem>(); try { var Vendor = data_Ass.ReadVendorName(); Assetlist.Add(new SelectListItem() { Value = "", Text = "---- Select Vendor Name----" }); for (int i = 0; i < Vendor.Tables[0].Rows.Count; i++) { Assetlist.Add(new SelectListItem() { Value = Vendor.Tables[0].Rows[i]["ID"].ToString(), Text = Vendor.Tables[0].Rows[i]["NAME"].ToString() }); } } catch (Exception exec) { BaseExceptionHandler.HandleException(ref exec); } return(Assetlist); }
public ActionResult AddVendorDetails(Vendors _vendor) { try { int result = 0; MTSHRDataLayer.Vendors _data = new MTSHRDataLayer.Vendors(); result = _data.Create(Convert.ToInt32(_vendor.Type), _vendor.Name, _vendor.Address, _vendor.Phone, _vendor.ContactPerson, _vendor.MobileNo, _vendor.Email); if (result == 1) { return(Content("Success")); } else { return(Content("Failed")); } } catch (Exception exec) { BaseExceptionHandler.HandleException(ref exec); throw exec; } }
public ActionResult Read() { MTSHRDataLayer.Vendors vendor = new MTSHRDataLayer.Vendors(); return(Json(JsonConvert.SerializeObject(vendor.ReadVendorName().Tables[0]), JsonRequestBehavior.AllowGet)); }