public async Task <ActionResult> Delete(int id, mstContact Emp) { HttpResponseMessage responseMessage = await client.DeleteAsync(url + "/" + id); if (responseMessage.IsSuccessStatusCode) { return(RedirectToAction("Index")); } return(RedirectToAction("Error")); }
public async Task <ActionResult> Create(mstContact Emp) { Emp.CreatedDate = DateTime.Today; Emp.CreatedUser = tokenContainer.UserId.ToString(); Emp.IdRekanan = (System.Guid)tokenContainer.IdRekananContact; HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url, Emp); if (responseMessage.IsSuccessStatusCode) { return(RedirectToAction("Index")); } return(RedirectToAction("Error")); }
public IHttpActionResult Post(mstRekananForm myData) { //membuat data rekanan yang baru, akan meng-insert data contact mstContact contactTemp = new mstContact(); contactTemp.UserId = myData.CreatedUser; contactTemp.IdRekanan = myData.IdRekanan; contactTemp.Name = myData.UserName; contactTemp.Title = string.Empty; contactTemp.CreatedUser = myData.CreatedUser; contactTemp.CreatedDate = DateTime.Today; contactTemp.IsActive = true; _repContact.Post(contactTemp); mstRekanan rekTemp = new mstRekanan(); rekTemp.InjectFrom(myData); rekTemp.LMDate = DateTime.Today; _repository.Post(rekTemp); return(Ok(rekTemp)); }
public IHttpActionResult Put(int id, mstContact myData) { _repository.Put(id, myData); return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Post(mstContact myData) { _repository.Post(myData); return(Ok(myData)); }
public async Task <IHttpActionResult> RegisterCalonRekanan(RegisterBindingModel model) { string strNamaRekananFound = _repRekanan.CheckRekananByNPWP(model.NomorNPWP); if (strNamaRekananFound == "") { AspNetUser myAspNetUser = _repContact.GetAspNetUserByEmail(model.Email); Guid myIdRekanan = Guid.NewGuid(); //insert into MstRekanan (get IdRekanan) mstRekanan rekananBaru = new mstRekanan(); rekananBaru.IdRekanan = myIdRekanan; rekananBaru.IdRegion = -1; rekananBaru.RegistrationNumber = "NEW000"; rekananBaru.ClassOfRekanan = 0; rekananBaru.IdTypeOfRekanan = model.IdTypeOfRekanan; rekananBaru.IdTypeOfBadanUsaha = -1; rekananBaru.Name = model.NamaRekanan; rekananBaru.Address = "alamt lengkap rekanan"; rekananBaru.Kota = ""; rekananBaru.Phone1 = "000"; rekananBaru.EmailAddress = model.Email; rekananBaru.LMDate = DateTime.Today; rekananBaru.CreatedUser = "******"; rekananBaru.CreatedDate = DateTime.Today; rekananBaru.IsActive = 0; try { _repRekanan.Post(rekananBaru); } catch (Exception ex) { string strErr = ex.Message; } //INSERT MSTCONTACT mstContact contactBaru = new mstContact(); contactBaru.UserId = myAspNetUser.Id; contactBaru.IdRekanan = myIdRekanan; contactBaru.Name = "Contact Person"; contactBaru.NomorKTP = "000"; contactBaru.Email1 = model.Email; contactBaru.Handphone1 = "000"; contactBaru.Telephone1 = "000"; contactBaru.Fax1 = "000"; contactBaru.CreatedUser = "******"; contactBaru.CreatedDate = DateTime.Today; contactBaru.IsActive = true; _repContact.Post(contactBaru); //insert into MstEmailPool mstEmailPool emailPoolBaru = new mstEmailPool(); emailPoolBaru.IdRekanan = myIdRekanan; emailPoolBaru.JudulEmail = "Informasi Login"; emailPoolBaru.IsiEmail = string.Format("Kepada Calon Rekanan, <br> Berikut ini adakan informasi akun :<br>Alamat Email : {0}<br>User Name : {1}" + "<br>Password : {2}", model.Email, model.Email, model.Password); emailPoolBaru.EmailTo = model.Email; emailPoolBaru.EmailFrom = "*****@*****.**"; emailPoolBaru.SentStatus = false; emailPoolBaru.CreatedDate = DateTime.Today; emailPoolBaru.CreatedUser = "******"; _repEmailPool.Post(emailPoolBaru); } return(Ok()); }