public HttpResponseMessage Delete([FromUri] int Id, [FromBody] int modifiedBy) { RegisterOut ro = new RegisterOut(); ro.ID = Id; ro.ModifiedBy = modifiedBy; return(Request.CreateResponse(HttpStatusCode.OK, ro.Delete())); }
public HttpResponseMessage Save(RegisterOut ro) { if (ro.ID > 0) { return(Request.CreateResponse(HttpStatusCode.OK, ro.Update())); } else { return(Request.CreateResponse(HttpStatusCode.OK, ro.Save())); } }
public async Task User_Is_Created_And_Retrieven_Successfully() { var user = new RegisterIn { Email = "*****@*****.**", Name = "Name", Password = "******" }; var expected = new RegisterOut { Email = user.Email, Name = user.Name }; using (var client = CreateClient()) using (var json = CreateJson(user)) { var postResult = await client.PostAsync($"/v1/Register", json); Assert.Equal(HttpStatusCode.OK, postResult.StatusCode); var postJson = await postResult.Content.ReadAsStringAsync(); JsonConvert.DeserializeObject <RegisterOut>(postJson).Should().BeEquivalentTo(expected); await Authenticate(client, user.Email, user.Password); var getResult = await client.GetAsync("/v1/Register"); Assert.Equal(HttpStatusCode.OK, getResult.StatusCode); var getJson = await getResult.Content.ReadAsStringAsync(); JsonConvert.DeserializeObject <RegisterOut>(getJson).Should().BeEquivalentTo(expected); } }
public HttpResponseMessage Get([FromUri] int Id, [FromBody] int LocationId) { return(Request.CreateResponse(HttpStatusCode.OK, RegisterOut.GetDetails(Id, LocationId))); }
public HttpResponseMessage Get([FromBody] int LocationId, [FromUri] DateTime?from, [FromUri] DateTime?to) { return(Request.CreateResponse(HttpStatusCode.OK, RegisterOut.GetDetails(LocationId, from, to))); }