public async Task <ApiResponse> PostUserAsync(UserDto user) { var postData = _mapper.Map <User>(user); postData.CreatedBy = 1; postData.CreatedOn = DateTime.Now; _dbContext.Entry(postData).State = EntityState.Added; await _dbContext.SaveChangesAsync(); user.UserID = postData.UserID; return(new ApiResponse { Data = user, Message = "Success", StatusCode = StatusCode.Created }); }
public async Task <ApiResponse> PostTestAsync(TestDto test) { var postData = _mapper.Map <Test>(test); postData.CreatedBy = 1; postData.CreatedOn = DateTime.Now; _dbContext.Entry(postData).State = EntityState.Added; await _dbContext.SaveChangesAsync(); test.TestID = postData.TestID; return(new ApiResponse { Data = test, Message = "Success", StatusCode = StatusCode.Created }); }
public async Task <ApiResponse> PostPatientAsync(PatientDto patient) { var postData = _mapper.Map <Patient>(patient); postData.CreatedBy = 1; postData.CreatedOn = DateTime.Now; _dbContext.Entry(postData).State = EntityState.Added; await _dbContext.SaveChangesAsync(); patient.PatientID = postData.PatientID; return(new ApiResponse { Data = patient, Message = "Success", StatusCode = StatusCode.Created }); }