는 평가
public class Company : Entity
{
public string Name { get; set; }
public Address Address { get; set; }
public Contact Contact { get; set; }
public string Password { get; set; }
public string UserName { get; set; }
public Image LogoImage { get; set; }
public DateTime RegistrationDate { get; set; }
public DateTime LastUpdated { get; set; }
public bool IsActive { get; set; }
public DateTime NextBillingDate { get; set; }
public Int64 TransactionLimit { get; set; }
}
public class Entity : IEntity
{
public Entity()
{
Id = Guid.NewGuid();
InsertionTime = DateTime.Now;
IsDeleted = false;
IsLocked = false;
}
public Guid Id
{
get;set;
}
public DateTime InsertionTime
{
get;set;
}
public int InsertUserId
{
get; set;
}
public bool IsDeleted
{
get; set;
}
public bool IsLocked
{
get; set;
}
public DateTime? UpdateTime
{
get;set;
}
public int? UpdateUserId
{
get; set;
}
}
:
이
는 타이프 라이터입니다 ---
save(company: Company): Observable<boolean> {
let headers = new Headers({ 'Content-Type': 'application/json' });
this._http.post(this._postUrl, /*JSON.stringify(*/company/*)*/, { headers: headers })
.subscribe(
(data) => {
console.log('Response');
new Observable<true>()
},
(err) => { console.log(err); new Observable<false>(); },
() => console.log('Complete')
);
return new Observable<false>();
}
onSignUpClicked(message: string): void {
this._service.save(this.company).subscribe(
res => console.log(res),
error => this.errorMessage = <any>error
);
이 타이프 스크립트 클래스입니다 기본 전화
getMeSomeServerData(someVar: string): Promise <IGenericRestResponse> {
let headers = new Headers();
headers.append("Content-Type", "application/json");
let url = "/getMeSomeServerData";
let post = this.http.post(url, JSON.stringify(someVar), {
headers: headers
}).map(response => response.json());
return post.toPromise();
}
그리고 asp.net MVC 백엔드 : NG2 응용 프로그램에서 서버에
// this of course goes within a controller
[HttpPost()]
[Route("getMeSomeServerData")]
public JsonNetResult GetMeSomeServerData(string someVar) {
GenericRestResponse response = new GenericRestResponse();
response.Error = false;
// do somthing
return new JsonNetResult(response);
}
JsonNetResult을위한 간단하게 사용자 정의 방법 객체를 json으로 직렬화합니다. 분명히 someVar와 IGenericRestResponse를 자신의 필요에 맞게 수정할 수 있습니다.
클라이언트 쪽에서는 약속 대신 Observable을 반환 할 수도 있습니다. promise 메서드는 내게 더 친숙하기 때문에 Observable의 특수 기능이 필요하지 않으면 사용합니다.
어떤 오류가 발생하고 있습니까? – brando