Example #1
0
        public async Task <BeauticiansTreatmentsResponse> SaveAsyncBeauticiansTreatments(BeauticiansTreatmentsModel beauticiansTreatments)
        {
            try
            {
                await _beauticiansTreatmentsRepository.AddAsyncBeauticiansTreatments(beauticiansTreatments);

                await _unitOfWork.CompleteAsync();

                return(new BeauticiansTreatmentsResponse(beauticiansTreatments));
            }
            catch (Exception ex)
            {
                return(new BeauticiansTreatmentsResponse($"An error occured when saving BeauticiansTreatments : {ex.Message}"));
            }
        }
Example #2
0
        public async Task <BeauticiansTreatmentsResponse> UpdateAsyncBeauticiansTreatments(int id, BeauticiansTreatmentsModel beauticiansTreatments)
        {
            var existingBeauticiansTreatments = await _beauticiansTreatmentsRepository.FindByIdBeauticiansTreatments(id);

            if (existingBeauticiansTreatments == null)
            {
                return(new BeauticiansTreatmentsResponse("BeauticiansTreatments Not found"));
            }

            try
            {
                _beauticiansTreatmentsRepository.UpdateAsyncBeauticiansTreatments(existingBeauticiansTreatments);
                await _unitOfWork.CompleteAsync();

                return(new BeauticiansTreatmentsResponse(existingBeauticiansTreatments));
            }
            catch (Exception ex)
            {
                return(new BeauticiansTreatmentsResponse($"An error occured when update BeauticiansTreatments : {ex.Message}"));
            }
        }
 public void RemoveAsyncBeauticiansTreatments(BeauticiansTreatmentsModel beauticiansTreatments)
 {
     _context.BeaticiansTreatments.Remove(beauticiansTreatments);
 }
 public void UpdateAsyncBeauticiansTreatments(BeauticiansTreatmentsModel beauticiansTreatments)
 {
     _context.BeaticiansTreatments.Update(beauticiansTreatments);
 }
 public async Task AddAsyncBeauticiansTreatments(BeauticiansTreatmentsModel beauticiansTreatments)
 {
     await _context.BeaticiansTreatments.AddAsync(beauticiansTreatments);
 }
Example #6
0
 public BeauticiansTreatmentsResponse(BeauticiansTreatmentsModel beauticiansTreatments) : this(true, string.Empty, beauticiansTreatments)
 {
 }
Example #7
0
 public BeauticiansTreatmentsResponse(bool success, string message, BeauticiansTreatmentsModel beauticiansTreatments) : base(success, message)
 {
     BeauticiansTreatments = beauticiansTreatments;
 }