Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Morpher.WebService.V3.Client/Russian/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,26 @@ public List<string> Adjectivize(string lemma)
return client.GetObject<List<string>>("/russian/adjectivize");
}
}

public Propis GetPropis(decimal n, string currency,
string padeg, string capitals, string nbsp, string delim)
{
if (string.IsNullOrWhiteSpace(currency))
{
throw new ArgumentEmptyException(nameof(currency));
}

using (var client = _newClient())
{
client.AddParam("n", n.ToString(CultureInfo.InvariantCulture));
client.AddParam("currency", currency);
client.AddParam("case", padeg);
client.AddParam("capitals", capitals);
client.AddParam("nbsp", nbsp);
client.AddParam("delim", delim);

return client.GetObject<Propis>("/russian/propis");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А обработка ошибок? Что если сервис вернет ошибку 400? Нужно преобразовать ее в известное исключение.

}
}
}
}
26 changes: 26 additions & 0 deletions Morpher.WebService.V3.Client/Russian/Propis.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Runtime.Serialization;

namespace Morpher.WebService.V3.Russian
{
[DataContract]
public class Propis
{
[DataMember]
public string propis1 { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[XmlElement]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем он? Вроде в других классах такого не было.


[DataMember]
public string propis2 { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В C# свойства принято называть с большой буквы: Propis2.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ок


[DataMember]
public string propis3 { get; set; }

[DataMember]
public string amount { get; set; }

[DataMember]
public string currency { get; set; }

[DataMember]
public string cents { get; set; }
}
}