public Response <string> removeemailblock([FromBody] ListBlockEmail request) { string userlogin = string.Empty; string token = Request.Headers["Authorization"]; // Get user login from token var info = this._authService.checkToken(token); Response <string> response = new Response <string>(); if (!string.IsNullOrEmpty(info.Username)) { return(this.bantuanHukumService.removeBlockingEmail(request.Id)); } else { response.message = "Unauthorize"; response.message_type = 2; } return(response); }
public Response <string> editBlockingEmail(ListBlockEmail email) { Response <string> response = new Response <string>(); if (email.Id > 0) { var ids = this.Db.LogEmails.FirstOrDefault(a => a.ID == email.Id); if (ids != null) { ids.To = email.Email; this.Db.LogEmails.Update(ids); this.Db.SaveChanges(); response.data = "updated"; response.message_type = 1; } } return(response); }
public Response <string> blockingEmail(ListBlockEmail email) { Response <string> response = new Response <string> { }; var q = this.Db.LogEmails.Where(a => a.To == email.Email && a.Blocked == true); if (q.Count() == 0) { this.Db.LogEmails.Add(new LogEmail { Blocked = true, To = email.Email }); this.Db.SaveChanges(); } else { response.message_type = 2; response.message = "Email sudah terdaftar dalam daftar blocking"; } return(response); }