public IHttpActionResult Apply(DismissalCaseApplyModel model) { if (model == null) { return(BadRequest("model cannot be null")); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _dismissalCaseBusiness.AddDismissalCase(model); return(Ok()); }
public void AddDismissalCase(DismissalCaseApplyModel model) { DismissalCase dismissalCase = new DismissalCase { AdditionalInfo = model.AdditionalInfo, AppealState = model.AppealState, Applicant = new Applicant { AgeInterval = model.ApplicantAgeInterval, EducationalState = model.ApplicantEducationalState, FullName = model.ApplicantFullName, Email = model.ApplicantEmail, Gender = model.ApplicantGender, PhoneNumber = model.ApplicantPhoneNumber, PositionId = model.ApplicantPositionId }, CityID = model.CityID, CompanyDescription = model.CompanyDescription, CompanySectorName = model.CompanySectorName, DeclaredTerminationReasonID = model.DeclaredTerminationReasonID, SGKTerminationReasonID = model.SGKTerminationReasonID, DetailedExperience = model.DetailedExperience, DismissalState = model.DismissalState, EmployeeCount = model.EmployeeCount, EmploymentDurationSince = model.EmploymentDurationSince, EmploymentTerminationDate = model.EmploymentTerminationDate, Guid = model.Guid, OtherDeclaredTerminationReason = model.OtherDeclaredTerminationReason, SignedDocuments = model.SignedDocuments, WantShareHisExperience = model.WantShareHisExperience }; if (model.SupportedByIds != null) { dismissalCase.DismissalCaseSupprtedBys = new List <DismissalCaseSupprtedBy>(); foreach (var item in model.SupportedByIds) { dismissalCase.DismissalCaseSupprtedBys.Add(new DismissalCaseSupprtedBy { SupportedById = item }); } } _unitOfWork.dismissalCaseRepository.Add(dismissalCase); _unitOfWork.Save(); }