예제 #1
0
        public ActionResult Add(FormCollection fc)
        {
            //Common Method to be called for Purchase Quotation Form
            var vvm = new VendorViewModel();

            try
            {
                vvm.VendorName      = fc["formValue[VendorName]"];
                vvm.VendorAddress   = fc["formValue[VendorAddress]"];
                vvm.VendorPAN       = fc["formValue[VendorPAN]"];
                vvm.VendorVAT       = fc["formValue[VendorVAT]"];
                vvm.VendorEmailId   = fc["formValue[VendorEmailId]"];
                vvm.ContactPerson   = fc["formValue[ContactPerson]"];
                vvm.VendorContactNo = fc["formValue[VendorContactNo]"];
                vvm.VendorCellNo    = fc["formValue[VendorCellNo]"];
                vvm.VendorStatus    = 1;
                vvm.UserId          = SessionHelper.UserId;
                vvm.Username        = SessionHelper.Username;

                var lstVendorContactNo = vvm.VendorContactNo.Split(',').ToList();
                var lstVendorCellNo    = vvm.VendorCellNo.Split(',').ToList();

                if (ModelState.IsValid)
                {
                    vvm.Id = _repVendor.AddVendorInfo(vvm);

                    var json = JsonConvert.SerializeObject(vvm);;

                    if (vvm != null)
                    {
                        return(Json(json));
                    }
                }
            }
            catch (IOException e)
            {
                if (e.Source != null)
                {
                    Console.WriteLine("IOException source: {0}", e.Source);
                    throw;
                }
            }

            return(PartialView(vvm));
        }