//-- Action Çalışmadan Önceki Durum public override void OnActionExecuting(HttpActionContext actionContext) { using (serkanISGEntities1 db = new serkanISGEntities1()) { StringBuilder sb = new StringBuilder(); foreach (var item in actionContext.ActionArguments) { sb.Append($"{item.Key} = {item.Value.ToString()},"); } db.LogRegister.Add(new LogRegister() { IsBefore = true, LogCaption = $"{actionContext.ControllerContext.ControllerDescriptor.ControllerName} - {actionContext.ActionDescriptor.ActionName}", //UserInfo = $"{Encoding.UTF8.GetString(Convert.FromBase64String(actionContext.Request.Headers.Authorization.Parameter))} ", Time = DateTime.Now, LogDetail = sb.ToString() });; db.SaveChanges(); } base.OnActionExecuting(actionContext); }
protected void btnUPdate_Click(object sender, EventArgs e) { try { MODUL_MAILAYAR upt = new MODUL_MAILAYAR(); upt = db.MODUL_MAILAYAR.FirstOrDefault(i => i.AD_MODUL == lblModulID.Text); switch (ckbCreate.Checked) { case true: upt.YENI_KAYIT = "Aktif"; break; case false: upt.YENI_KAYIT = "Pasif"; break; } switch (ckbUpdate.Checked) { case true: upt.GUNCELLEME_KAYIT = "Aktif"; break; case false: upt.GUNCELLEME_KAYIT = "Pasif"; break; } switch (ckbDelete.Checked) { case true: upt.SILME_KAYIT = "Aktif"; break; case false: upt.SILME_KAYIT = "Pasif"; break; } ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Mail Ayarları Güncellenmiştir !','succsess');", true); db.SaveChanges(); grdMODULS.DataSource = db.MODUL_MAILAYAR.ToList(); grdMODULS.DataBind(); } catch (Exception) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "myFunction('Hay Aksi! Beklenmedik bir hata oluştu :(','fail');", true); } }
public HttpResponseMessage Post([FromBody] PERSONEL per) { per.PERSONEL_AD = per.PERSONEL_AD.ToUpper(); per.PERSONEL_SOYAD = per.PERSONEL_SOYAD.ToUpper(); per.YAPTIGI_IS = per.YAPTIGI_IS.ToUpper(); db.PERSONEL.Add(per); if (db.SaveChanges() > 0) { return(Request.CreateResponse(HttpStatusCode.Created, per)); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Uygunsuzluk Ekleme İşlemi Yapılamadı!")); } }
//Çalıştıktan Sonraki duurm public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { using (serkanISGEntities1 db = new serkanISGEntities1()) { db.LogRegister.Add(new LogRegister() { IsBefore = false, //UserInfo = $"{Encoding.UTF8.GetString(Convert.FromBase64String(actionExecutedContext.Request.Headers))} ", LogCaption = $"{actionExecutedContext.ActionContext.ControllerContext.ControllerDescriptor.ControllerName} -- {actionExecutedContext.ActionContext.ActionDescriptor.ActionName}", Time = DateTime.Now, LogDetail = Convert.ToString(actionExecutedContext.ActionContext.Response.StatusCode) }); db.SaveChanges(); } base.OnActionExecuted(actionExecutedContext); }