public async Task <IViewComponentResult> InvokeAsync() { var model = new SiteAWSProperty(); var result = await _service.GetAWSPropertySettingsAsync(); if (result.Data != null) { model.aws_property_id = result.Data.aws_property_id; model.bucket_name = result.Data.bucket_name; model.access_key = result.Data.access_key; model.secret_key = result.Data.secret_key; model.base_url = result.Data.base_url; } return(await Task.FromResult((IViewComponentResult)View("Default", model))); }
public async Task <ApiResponse> SaveAWSPropertySettingsAsync(SiteAWSProperty model) { var _apiRes = new ApiResponse(); var result = await _context.site_aws_property.FirstOrDefaultAsync(); if (result != null) { result.bucket_name = model.bucket_name; result.access_key = model.access_key; result.secret_key = model.secret_key; result.base_url = model.base_url; result.is_active = model.is_active; result.updated_by = model.UserId; result.updated_on = DateTime.Now; _context.site_aws_property.Update(result); _context.SaveChanges(); } else { model.created_by = model.UserId; model.created_on = DateTime.Now; model.updated_by = model.UserId; model.updated_on = DateTime.Now; await _context.site_aws_property.AddAsync(model); await _context.SaveChangesAsync(); } _apiRes.Message = "AWS Property settings has been saved."; _apiRes.Status = true; return(_apiRes); }
public async Task <ApiResponse> SaveAWSPropertySettingsAsync(SiteAWSProperty model) => await _repository.SaveAWSPropertySettingsAsync(model);