public async Task <IActionResult> ContractAdd(VendorContractViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                var record = this.Mapper.Map <VendorContractModel>(model);
                if (model.Id > 0)
                {
                    ////Update
                    record.UpdateAuditInfo(new Guid(this.HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.Sid).Value));
                    await this.vendorService.UpdateVendorContractAsync(record);

                    this.ShowMessage("Updated Successfully");
                    this.TempData["nextview"] = "#vendor-contract";
                }
                else
                {
                    record.SetAuditInfo(new Guid(this.HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.Sid).Value));
                    await this.vendorService.AddVendorContractAsync(record);

                    this.ShowMessage("Added Successfully");
                    this.TempData["nextview"] = "#vendor-contract";
                }

                return(this.Json("success"));
            }

            return(this.Json("failure"));
        }
        public async Task <IActionResult> ContractAdd(int id, int vendorId)
        {
            this.ViewBag.VendorId = id;
            VendorContractViewModel model = new VendorContractViewModel
            {
                Id       = 0,
                VendorId = vendorId
            };

            if (id > 0)
            {
                model = this.Mapper.Map <VendorContractViewModel>(await this.vendorService.GetVendorContractsByIdentifierAsync(id));
            }

            model.MarginTypeItems = model.MarginType == 0 ? new List <SelectListItem>() : (await this.masterService.GetMarginTypeMaster(string.Empty, 1, model.MarginType)).ToSelectList();
            return(this.PartialView("_ContractAdd", model));
        }