public ActionResult Create()
        {
            var dropdownlist_ContractStatus_Property = new CreateViewModel.DropDownList_ContractStatus()
            {
                ContractStatuses = ContractStatusService.GetContractStatuses().Where(cs => cs.Name == "Unsent" || cs.Name == "Sent" || cs.Name == "Received").ToList()
            };

            var createViewModel = new CreateViewModel()
            {
                DropDownList_ContractStatus_Property = dropdownlist_ContractStatus_Property
            };

            return View(createViewModel);
        }
        public ActionResult Create(CreateViewModel createViewModel)
        {

            if (!ModelState.IsValid)
            {
                return View(createViewModel);
            }

            var selectedContractStatus = ContractStatusService.FindById(createViewModel.DropDownList_ContractStatus_Property.SelectedContractStatus);
            var contract = new Contract()
            {
                Name = createViewModel.Name,
                Description = createViewModel.Description,
                ContractStatus = selectedContractStatus,
                ContractStatusId = createViewModel.DropDownList_ContractStatus_Property.SelectedContractStatus != -1 ? (int?)createViewModel.DropDownList_ContractStatus_Property.SelectedContractStatus : null,
                ExpiredOn = !String.IsNullOrEmpty(createViewModel.ExpiredOn) ? (DateTime?)DateTime.ParseExact(createViewModel.ExpiredOn, "dd/MM/yyyy", CultureInfo.InvariantCulture) : null,
                CreatedDate = DateTime.Now,
            };

            foreach (string file in Request.Files)
            {
                if (Request.Files[file].ContentLength <= 0 || Request.Files[file] == null)
                    continue;
                string pathToSave = Server.MapPath("~/Files/Contracts");
                string oldFilename = Path.GetFileName(Request.Files[file].FileName);
                string fileExtension = Path.GetExtension(Request.Files[file].FileName);
                string uploadFileName = String.Format(Guid.NewGuid() + fileExtension);
                Request.Files[file].SaveAs(Path.Combine(pathToSave, uploadFileName));
                contract.OldContractFileName = Request.Files[file].FileName;
                contract.ContractFile = Path.Combine(pathToSave, uploadFileName);
            }

            ContractService.CreateContract(contract);
            TempData["ContractId"] = contract.ContractId;
            TempData["ContractName"] = contract.Name;
            TempData["Message"] = ContractsMessage.CreateSuccess;
            return RedirectToAction("index", "contracts");
        }