public async void PostProfileEmail(int _box, int _profileEmailId) { var connection = await this.apiService.CheckConnection(); if (!connection.IsSuccess) { await Application.Current.MainPage.DisplayAlert( Languages.Error, connection.Message, Languages.Accept); await App.Navigator.PopAsync(); } Box_ProfileEmail box_ProfileEmail = new Box_ProfileEmail { BoxId = _box, ProfileEmailId = _profileEmailId }; var apiSecurity = Application.Current.Resources["APISecurity"].ToString(); var profileEmail = await this.apiService.Post2( apiSecurity, "/api", "/Box_ProfileEmail", box_ProfileEmail); }
public async Task <IHttpActionResult> PutBox_ProfileEmail(int id, Box_ProfileEmail box_ProfileEmail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != box_ProfileEmail.Box_ProfileEmailId) { return(BadRequest()); } db.Entry(box_ProfileEmail).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Box_ProfileEmailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
//Obtener Lista Email private async Task <ObservableCollection <ProfileEmail> > GetListEmail(int _BoxId) { this.IsRunning = true; List <ProfileEmail> listEmail; var connection = await this.apiService.CheckConnection(); if (!connection.IsSuccess) { this.IsRunning = false; await Application.Current.MainPage.DisplayAlert( Languages.Error, connection.Message, Languages.Accept); return(null); } var apiSecurity = Application.Current.Resources["APISecurity"].ToString(); ProfileEmail = new ObservableCollection <ProfileEmail>(); listEmail = await this.apiService.GetListByUser <ProfileEmail>( apiSecurity, "/api", "/ProfileEmails", MainViewModel.GetInstance().User.UserId); foreach (ProfileEmail ItemEmail in listEmail) { Box_ProfileEmail RelationEmail; RelationEmail = new Box_ProfileEmail { BoxId = _BoxId, ProfileEmailId = ItemEmail.ProfileEmailId }; var response = await this.apiService.Get( apiSecurity, "/api", "/Box_ProfileEmail/GetBox_ProfileEmail", RelationEmail); ItemEmail.Exist = response.IsSuccess; } var ListOrderBy = listEmail.OrderBy(x => x.Name).ToList(); foreach (ProfileEmail profEmail in ListOrderBy) { ProfileEmail.Add(profEmail); } if (ProfileEmail.Count == 0) { EmptyList = true; } this.IsRunning = false; return(ProfileEmail); }
public async Task <ActionResult> DeleteConfirmed(int id) { Box_ProfileEmail box_ProfileEmail = await db.Box_ProfileEmail.FindAsync(id); db.Box_ProfileEmail.Remove(box_ProfileEmail); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <bool> GetListEmail(int _UserId, int _BoxId) { try { List <ProfileEmail> listEmail = new List <ProfileEmail>(); var apiSecurity = Application.Current.Resources["APISecurity"].ToString(); listEmail = await this.apiService.GetListByUser <ProfileEmail>( apiSecurity, "/api", "/ProfileEmails", _UserId); foreach (ProfileEmail ItemEmail in listEmail) { Box_ProfileEmail RelationEmail; RelationEmail = new Box_ProfileEmail { BoxId = _BoxId, ProfileEmailId = ItemEmail.ProfileEmailId }; var response = await this.apiService.Get( apiSecurity, "/api", "/Box_ProfileEmail/GetBox_ProfileEmail", RelationEmail); ItemEmail.Exist = response.IsSuccess; if (ItemEmail.Exist == true) { var foreingProfile = new ForeingProfile { BoxId = _BoxId, UserId = ItemEmail.UserId, ProfileName = ItemEmail.Name, value = ItemEmail.Email, ProfileType = "Email" }; //Crear perfil de correo de box local predeterminada using (var connSQLite = new SQLite.SQLiteConnection(App.root_db)) { connSQLite.Insert(foreingProfile); } } } NotNull1 = true; return(NotNull1); } catch (Exception e) { Console.WriteLine(e); NotNull1 = false; return(NotNull1); } }
public async Task <IHttpActionResult> PostBox_ProfileEmail(Box_ProfileEmail box_ProfileEmail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Box_ProfileEmail.Add(box_ProfileEmail); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = box_ProfileEmail.Box_ProfileEmailId }, box_ProfileEmail)); }
public async Task <ActionResult> Edit([Bind(Include = "Box_ProfileEmailId,BoxId,ProfileEmailId")] Box_ProfileEmail box_ProfileEmail) { if (ModelState.IsValid) { db.Entry(box_ProfileEmail).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.BoxId = new SelectList(db.Boxes, "BoxId", "Name", box_ProfileEmail.BoxId); ViewBag.ProfileEmailId = new SelectList(db.ProfileEmails, "ProfileEmailId", "Name", box_ProfileEmail.ProfileEmailId); return(View(box_ProfileEmail)); }
// GET: Box_ProfileEmail/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Box_ProfileEmail box_ProfileEmail = await db.Box_ProfileEmail.FindAsync(id); if (box_ProfileEmail == null) { return(HttpNotFound()); } return(View(box_ProfileEmail)); }
// GET: Box_ProfileEmail/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Box_ProfileEmail box_ProfileEmail = await db.Box_ProfileEmail.FindAsync(id); if (box_ProfileEmail == null) { return(HttpNotFound()); } ViewBag.BoxId = new SelectList(db.Boxes, "BoxId", "Name", box_ProfileEmail.BoxId); ViewBag.ProfileEmailId = new SelectList(db.ProfileEmails, "ProfileEmailId", "Name", box_ProfileEmail.ProfileEmailId); return(View(box_ProfileEmail)); }
private async Task <ObservableCollection <ProfileEmail> > GetListEmail(int _BoxId) { this.IsRunning = true; List <ProfileEmail> listEmail; var apiSecurity = Application.Current.Resources["APISecurity"].ToString(); ProfileEmail = new ObservableCollection <ProfileEmail>(); listEmail = await this.apiService.GetListByUser <ProfileEmail>( apiSecurity, "/api", "/ProfileEmails", MainViewModel.GetInstance().User.UserId); var ListOrderBy = listEmail.OrderBy(x => x.Name).ToList(); foreach (ProfileEmail ItemEmail in ListOrderBy) { Box_ProfileEmail RelationEmail; RelationEmail = new Box_ProfileEmail { BoxId = _BoxId, ProfileEmailId = ItemEmail.ProfileEmailId }; var response = await this.apiService.Get( apiSecurity, "/api", "/Box_ProfileEmail/GetBox_ProfileEmail", RelationEmail); ItemEmail.Exist = response.IsSuccess; //if (ItemEmail.Exist == true) //{ var Email = Converter.ToProfileLocalE(ItemEmail); ProfilePerfiles.Add(Email); //} } this.IsRunning = false; return(ProfileEmail); }