ContactMemberUpdate
Editing a contact's information
{{:: 'controllers.documentation.chooseFramework' | translate }}
PM > Install-Package
NikSms.Library.Net
PM > Install-Package
NikSms.Library.NetCore
using NikSms.Library.Net.ViewModels;
using NikSms.Library.Net.WebApi;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace AwesomeApplication
{
public class NikSmsApiV2Client
{
private readonly PublicApiV2 service;
public NikSmsApiV2Client(string username, string password)
{
service = new PublicApiV2(username, password);
}
public async Task<bool> ContactMemberUpdate(long id, string description, string email, string fullName, int groupId, string mobile, string state, Nullable<DateTime> birthDate,bool isMale = true, bool isMarried = false)
{
var result = await service.ContactMemberUpdate(new ApiV2ContactMember
{
Id = id,
BirthDate = birthDate,
Description = description,
Email = email,
FullName = fullName,
GroupId = groupId,
Male = isMale,
Married = isMarried,
Mobile = mobile,
State = state
});
switch (result.Status)
{
case LibOperationResultStatus.Success:
return result.Data;
case LibOperationResultStatus.InvalidModel:
throw new Exception("Some required inputs are misssing...");
case LibOperationResultStatus.UnAuthorized:
throw new Exception("Some thing is wrong with your account (call support!)");
case LibOperationResultStatus.Failed:
throw new Exception("Ooops its our fault!");
default:
throw new Exception("You sould not be here... :D");
}
}
}
}