public async Task <IActionResult> updateAdminProfile([FromBody] updateProfileModel model) { Dictionary <String, Object> dctData = new Dictionary <string, object>(); HttpStatusCode statusCode = HttpStatusCode.OK; try { //model.Image = CommonHelper.SaveImage(HttpContext, "Images\\AdminProfile", model.Image, true, model.ImageExtn); model.Image = CommonHelper.SaveImage(HttpContext, "Avatars\\Admin", model.Image, true, model.ImageExtn); //transaction = await iadmin.updateAdminProfile(model); var result = await iadmin.updateAdminProfile(model); var loginDetail = result.Item1; transaction = result.Item2; dctData.Add("loginDetail", loginDetail); } catch (Exception ex) { transaction = CommonHelper.TransactionErrorHandler(ex); statusCode = HttpStatusCode.BadRequest; } dctData.Add("Status", transaction); return(this.StatusCode(Convert.ToInt32(statusCode), dctData)); }
//UpdateAdminProfiel public async Task <Tuple <List <updateProfileModel>, TranStatus> > updateAdminProfile(updateProfileModel model) { using (var connection = new SqlConnection(ConnectionString)) { await connection.OpenAsync(); DynamicParameters parameter = new DynamicParameters(); parameter.Add("@ID", model.ID); parameter.Add("@Image", model.Image); parameter.Add("@Username", model.Username); parameter.Add("@Gender", model.Gender); parameter.Add("@Mobile", model.Mobile); parameter.Add("@Companyname", model.Companyname); parameter.Add("@Address", model.Address); parameter.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 500); parameter.Add("@Code", dbType: DbType.Int32, direction: ParameterDirection.Output); var result = await connection.QueryAsync <updateProfileModel>("updateAdminProfile", parameter, commandType : CommandType.StoredProcedure); transaction.returnMessage = parameter.Get <string>("@Message"); transaction.code = parameter.Get <int>("@Code"); return(new Tuple <List <updateProfileModel>, TranStatus>(result.ToList(), transaction)); } }
//UpdateAdminProfile //public Task<TranStatus> updateAdminProfile(updateProfileModel model) //{ // using (adminRepository = new AdminRepository()) // { // return adminRepository.updateAdminProfile(model); // } //} public Task <Tuple <List <updateProfileModel>, TranStatus> > updateAdminProfile(updateProfileModel model) { using (adminRepository = new AdminRepository()) { return(adminRepository.updateAdminProfile(model)); } }