public bool SaveProfileInfo(out ChangeNameRequest changeNameRequest, string firstName = null, string lastName = null, string maidenName = null, Sex?sex = null, RelationType?relation = null, long?relationPartnerId = null, DateTime?birthDate = null, BirthdayVisibility?birthDateVisibility = null, string homeTown = null, long?countryId = null, long?cityId = null) { VkErrors.ThrowIfNumberIsNegative(() => relationPartnerId); VkErrors.ThrowIfNumberIsNegative(() => countryId); VkErrors.ThrowIfNumberIsNegative(() => cityId); changeNameRequest = null; var parameters = new VkParameters { { "first_name", firstName }, { "last_name", lastName }, { "maiden_name", maidenName }, { "sex", ((sex ?? Sex.Unknown) == Sex.Unknown) ? null : sex }, { "relation", relation }, { "relation_partner_id", relationPartnerId }, { "bdate", birthDate != null?birthDate.Value.ToString("dd.MM.yyyy") : null }, { "bdate_visibility", birthDateVisibility }, { "home_town", homeTown }, { "country_id", countryId }, { "city_id", cityId } }; var response = _vk.Call("account.saveProfileInfo", parameters); changeNameRequest = response["name_request"]; return(response["changed"]); }
public bool SaveProfileInfo(out ChangeNameRequest changeNameRequest, string firstName = null, string lastName = null, string maidenName = null, Sex?sex = null, RelationType?relation = null, long?relationPartnerId = null, DateTime?birthDate = null, BirthdayVisibility?birthDateVisibility = null, string homeTown = null, long?countryId = null, long?cityId = null) { var parameters = new AccountSaveProfileInfoParams { FirstName = firstName, LastName = lastName, MaidenName = maidenName, Sex = sex.Value, Relation = relation.Value, RelationPartner = relationPartnerId.HasValue ? new User { Id = relationPartnerId.Value } : null, BirthDate = birthDate?.ToShortDateString(), BirthdayVisibility = birthDateVisibility.Value, HomeTown = homeTown, Country = new Country { Id = countryId }, City = new City { Id = cityId } }; return(SaveProfileInfo(out changeNameRequest, parameters)); }
public bool UpdateName(ChangeNameRequest request) { var item = Inventory.FindById(request.Id); item.Name = request.Name; return(Inventory.Update(item)); }
public bool UpdateInventoryItemName(ChangeNameRequest request) { var item = GetInventoryItemById(request.Id); item.Name = request.Name; // changes to the fetch object are tracked by default. // calling save changes will update all tracked items with their new data. return(_context.SaveChanges() != 0); }
public ActionResult ChangeName(ChangeNameRequest model) { var response = _UserService.ChangeName(model); if (response == null) { return(BadRequest("Something went wrong...")); } return(Ok(response)); }
public bool SaveProfileInfo(out ChangeNameRequest changeNameRequest, AccountSaveInfoParams @params) { VkErrors.ThrowIfNumberIsNegative(() => @params.RelationPartnerId); VkErrors.ThrowIfNumberIsNegative(() => @params.CountryId); VkErrors.ThrowIfNumberIsNegative(() => @params.CityId); var response = _vk.Call("account.saveProfileInfo", @params); changeNameRequest = response["name_request"]; return(response["changed"]); }
public Profile NameChange([FromBody] ChangeNameRequest entity) { entity.PublicID = User.Identity.Name; ResponseMessage <Profile> request = _profileService.ChangeName(entity); if (!request.IsSuccess) { throw new Exception(request.ErrorMessage); } return(request.ResponseObject); }
public async Task <IActionResult> ChangeName(int listId, ChangeNameRequest request) { var authorisationResponse = await _listAuthoriser.IsOwner(listId, _userProfileId); if (!authorisationResponse.AuthorisationResult) { return(NotFound()); } await _listWriter.ChangeName(listId, request.Name); return(Ok()); }
/// <summary> /// Редактирует информацию текущего профиля. /// </summary> /// <param name="changeNameRequest"> /// Если в параметрах передавалось имя или фамилия пользователя, /// в этом параметре будет возвращен объект типа ChangeNameRequest /// </param> /// <param name="params"> The parameters. </param> /// <returns> /// Результат отмены заявки. /// </returns> /// <remarks> /// Страница документации ВКонтакте http://vk.com/dev/account.saveProfileInfo /// </remarks> public bool SaveProfileInfo(out ChangeNameRequest changeNameRequest, AccountSaveProfileInfoParams @params) { var response = _vk.Call(methodName: "account.saveProfileInfo", parameters: @params); changeNameRequest = null; if (response.ContainsKey(key: "name_request")) { changeNameRequest = response[key : "name_request"]; } return(response[key : "changed"]); }
public virtual async Task <IStatusResponse> ChangeNameAsync( ChangeNameRequest model, CancellationToken token = default) { model.ArgumentNullCheck(nameof(model)); using (var scope = TransactionFactory.CreateTransaction()) { var result = await service.ChangeNameAsync(model, token) .ConfigureAwaitFalse(); scope.Complete(); return(result); } }
public string ChangeName(ChangeNameRequest model) { var user = _Users.Find(x => x.Id == model.id).SingleOrDefault(); if (user == null) { return(null); } user.name = model.name; _Users.ReplaceOne(sub => sub.Id == model.id, user); return(generateJwtToken(user)); }
public ResponseMessage <Profile> ChangeName(ChangeNameRequest entity) { ResponseMessage <Profile> response = new ResponseMessage <Profile>(); Profile profileEntity = _profileRepository.GetByID(entity.PublicID.Reverse()); try { profileEntity.Name = entity.NewName; response.ResponseObject = _profileRepository.ChangeName(profileEntity); response.IsSuccess = true; response.ErrorMessage = "Success"; } catch (Exception ex) { response.IsSuccess = false; response.ErrorMessage = ex.Message; } return(response); }
public virtual async Task <IStatusResponse> ChangeNameAsync( ChangeNameRequest model, CancellationToken token = default) { model.ArgumentNullCheck(nameof(model)); var entity = await store.GetEntityAsync(model.Id, token); IStatusResponse response; if (entity == null) { response = NotFoundStatusResponse(model.Id); } else { model.Name.UpdateEntity(entity.Name); await context.SaveChangesAsync(token); response = new StatusResponse(entity.Id); } return(response); }
public async Task <IActionResult> ChangeName([FromBody] ChangeNameRequest request) { try { var thisUserId = ClaimsExtractor.GetUserIdClaim(User.Claims); await mUsersService.ChangeName(request.newName, thisUserId); return(Ok(new ResponseApiModel <bool> { IsSuccessfull = true })); } catch (InvalidDataException ex) { return(BadRequest(new ResponseApiModel <bool> { IsSuccessfull = false, ErrorMessage = ex.Message })); } catch (KeyNotFoundException ex) { return(NotFound(new ResponseApiModel <bool> { IsSuccessfull = false, ErrorMessage = ex.Message })); } catch (Exception) { return(StatusCode((int)HttpStatusCode.InternalServerError, new ResponseApiModel <bool> { IsSuccessfull = false })); } }
public IEnumerable <ChangeNameRequest> GetNameAndIdsInStorageLocation(string location) { var items = Inventory.Find(x => x.StorageLocation == location); var requests = new List <ChangeNameRequest>(); for (int i = 0; i < items.Count(); i++) { var n = new ChangeNameRequest() { Name = items.ElementAt(i).Name, Id = items.ElementAt(i).Id }; requests.Add(n); } return(items.Select(x => { return new ChangeNameRequest { Id = x.Id, Name = x.Name }; })); }
/// <summary> /// Редактирует информацию текущего профиля. /// </summary> /// <param name="changeNameRequest">Если в параметрах передавалось имя или фамилия пользователя, /// в этом параметре будет возвращен объект типа <see cref="ChangeNameRequest" />, содержащий информацию о заявке на смену имени.</param> /// <param name="params">The parameters.</param> /// <returns> /// Результат отмены заявки. /// </returns> /// <remarks> /// Страница документации ВКонтакте <seealso cref="http://vk.com/dev/account.saveProfileInfo" />. /// </remarks> public bool SaveProfileInfo(out ChangeNameRequest changeNameRequest, AccountSaveProfileInfoParams @params) { var response = _vk.Call("account.saveProfileInfo", @params); changeNameRequest = null; if (response.ContainsKey("name_request")) { changeNameRequest = response["name_request"]; } return response["changed"]; }
public bool SaveProfileInfo(out ChangeNameRequest changeNameRequest, string firstName = null, string lastName = null, string maidenName = null, Sex? sex = null, RelationType? relation = null, long? relationPartnerId = null, DateTime? birthDate = null, BirthdayVisibility? birthDateVisibility = null, string homeTown = null, long? countryId = null, long? cityId = null) { VkErrors.ThrowIfNumberIsNegative(() => relationPartnerId); VkErrors.ThrowIfNumberIsNegative(() => countryId); VkErrors.ThrowIfNumberIsNegative(() => cityId); changeNameRequest = null; var parameters = new VkParameters { {"first_name", firstName}, {"last_name", lastName}, {"maiden_name", maidenName}, {"sex", ((sex ?? Sex.Unknown) == Sex.Unknown) ? null : sex}, {"relation", relation}, {"relation_partner_id", relationPartnerId}, {"bdate", birthDate != null ? birthDate.Value.ToString("dd.MM.yyyy") : null}, {"bdate_visibility", birthDateVisibility}, {"home_town", homeTown}, {"country_id", countryId}, {"city_id", cityId} }; var response = _vk.Call("account.saveProfileInfo", parameters); changeNameRequest = response["name_request"]; return response["changed"]; }
public bool SaveProfileInfo(out ChangeNameRequest changeNameRequest, AccountSaveInfoParams @params) { VkErrors.ThrowIfNumberIsNegative(() => @params.RelationPartnerId); VkErrors.ThrowIfNumberIsNegative(() => @params.CountryId); VkErrors.ThrowIfNumberIsNegative(() => @params.CityId); var response = _vk.Call("account.saveProfileInfo", @params); changeNameRequest = response["name_request"]; return response["changed"]; }
public bool SaveProfileInfo(out ChangeNameRequest changeNameRequest, string firstName = null, string lastName = null, string maidenName = null, Sex? sex = null, RelationType? relation = null, long? relationPartnerId = null, DateTime? birthDate = null, BirthdayVisibility? birthDateVisibility = null, string homeTown = null, long? countryId = null, long? cityId = null) { var parameters = new AccountSaveInfoParams { FirstName = firstName, LastName = lastName, MaidenName = maidenName, Sex = sex.Value, Relation = relation.Value, RelationPartnerId = relationPartnerId, BirthDate = birthDate, BirthDateVisibility = birthDateVisibility.Value, HomeTown = homeTown, CountryId = countryId, CityId = cityId }; return SaveProfileInfo(out changeNameRequest, parameters); }
public async Task <IActionResult> PatchName([Required] ChangeNameRequest model, CancellationToken token) { var result = await service.ChangeNameAsync(model, token); return(GenerateResponse(result)); }
public bool UpdateName(ChangeNameRequest request) { return(_service.UpdateName(request)); }
public bool UpdateName(ChangeNameRequest request) { // return _liteDbService.UpdateName(request); return(_dataService.UpdateInventoryItemName(request)); }