public IActionResult CreatePromotion(CreatePromotionDto createPromotionDto) { try { Enrollment enrollment = _dbService.Promote(createPromotionDto); return(Created($"/api/enrollments/{enrollment.IdEnrollment}", enrollment)); } catch (EnrollmentNotFoundException e) { return(NotFound()); } }
public async Task CreatePromotion(CreatePromotionDto input) { var header = _employeeRepository.Get(input.EmployeeId); var @employeepromotion = input.MapTo <Promotion>(); @employeepromotion.TenantId = AbpSession.GetTenantId(); @employeepromotion = Promotion.Create(input.FromDesignation, input.ToDesignation, input.PromotedDate.Value, input.JobDescription, input.Remark); header.Promotions.Add(@employeepromotion); await CurrentUnitOfWork.SaveChangesAsync(); }
public Enrollment Promote(CreatePromotionDto dto) { using (var conn = new SqlConnection(connectionString)) using (var cmd = new SqlCommand()) { conn.Open(); cmd.Connection = conn; FindEnrollmentBySemesterAndStudies(cmd, dto.Semester, dto.Studies); cmd.CommandText = @"promoteStudentsByStudiesAndSemester"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@Studies", dto.Studies); cmd.Parameters.AddWithValue("@Semester", dto.Semester); cmd.ExecuteNonQuery(); return(FindEnrollmentBySemesterAndStudies(cmd, 1 + dto.Semester, dto.Studies)); } }