public void CreateContract(ContractModel model) { var Contract = _service.GetContractById(0); var Product = _service.GetProductById(model.ProductId); if (!Equals(Contract, null)) { ExceptionContent(HttpStatusCode.InternalServerError, "contract_exist"); } Contract = new contract() { address = "", contract_id = 0, employee_id = model.EmployeeId, note = model.Note, ppm_local = Product.ppm_local, ppm_mobile = Product.ppm_mobile, ppm_std = Product.ppm_std, product_id = model.ProductId, price = model.Price, product_name = Product.product_name, product_time_used = Product.time_used, product_type = Product.time_type, security_deposit = _service.GetSecurityDepositByProductId(model.ProductId), signing_date = ConvertDatetime.GetCurrentUnixTimeStamp(), status = 1, store_id = model.StoreId, time_used_available = Product.time_used, user_id = model.UserId, start_date = model.StartDate, end_date = ConvertDatetime.GetEndDateWithMonthUsed(model.StartDate, Product.month_available), }; _service.SaveContract(Contract); }