예제 #1
0
 // PUT: api/AdminPelanggan/5
 public async Task <IHttpActionResult> Put(int id, [FromBody] PelangganModel value)
 {
     try
     {
         return(Ok(await domain.SaveChange(value)));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
예제 #2
0
        public async Task <IHttpActionResult> UpdateProfile(PelangganModel model)
        {
            try
            {
                PelangganDomain dom    = new PelangganDomain();
                var             result = await dom.SaveChange(model);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
예제 #3
0
        public async Task <IHttpActionResult> Register(RegisterModel model)
        {
            try
            {
                var register = await RegisterPelanggan(model.Email, model.Password);

                PelangganModel pel = (PelangganModel)model;
                pel.IdUser = register.Item1.Id;
                PelangganDomain dom    = new PelangganDomain();
                var             result = await dom.SaveChange(pel);

                return(Ok(register.Item2));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }