public ActionResult Register() { var model = new Carnet(); return(View(model)); }
public static CarnetValidation Map(CostCenterDropdown list, Carnet model) { return(new CarnetValidation() { Id = model.ID, Barcode = model.Barcode, //CostCenter = list.CostCenter }); }
public void AddCarnet(CarnetType carnetType, Guid trenerId) { Carnet t = new Carnet() { IsActive = false, Type = carnetType, ClientID = trenerId }; _carnetRepository.AddCarnet(t); }
public void ActivateCarnet(Guid id) { DateTime start = DateTime.Now; Carnet carnet = GetCarnet(id); carnet.IsActive = true; carnet.DateStart = start; carnet.DateEnd = start.AddDays(carnet.Type.Duration); _carnetRepository.ActivateCarnet(carnet); }
private void ClickAccéderCarnet(object sender, RoutedEventArgs e) { this.carnet = this.col.GetCarnet(txtNom.Text, txtPrénom.Text); if (this.carnet == null) { DialogResult = false; } else { DialogResult = true; } }
public async Task <JsonResult> Delete([Bind(Include = "ExpedienteId,VacunaId")] Carnet carnet) { var result = await DeleteAsync("api/Carnet?idExpediente=" + carnet.ExpedienteId + "&idVacuna=" + carnet.VacunaId); if (result.IsSuccessStatusCode) { return(Json(carnet)); } var Error = await ErrorAsync("Carnet", "Delete", "Error eliminar vacuna compruebe los campos", 400); return(new JsonHttpStatusResult(new { Error }, HttpStatusCode.BadRequest)); }
public Carnet Insert(Carnet entity) { try { DB.InsertarCarnet(entity.ExpedienteId, entity.VacunaId, entity.Fecha_Vacunacion); var Carnet = mapper.Map <Carnet, Carnet>(entity); return(Carnet); } catch (Exception ex) { throw ex; } }
// POST: api/Carnet public IHttpActionResult Post([FromBody] Carnet carnet) { try { carnet = CarnetServicio.Insert(carnet); Uri uri = new Uri(Url.Request.RequestUri + "/" + carnet.ExpedienteId); return(Created(uri, ModelFactory.Create <CarnetModel, Carnet>(carnet, uri))); } catch (Exception ex) { Log.Error <CarnetController>("Post Se ha producido un error en el llamado de la URI= " + Url.Request.RequestUri, ex); return(BadRequest()); } }
public ActionResult Register(Carnet model) { if (!ModelState.IsValid) { return(View(model)); } if (model.ID == 0) { model.RegistrationDate = DateTime.Now; _repository.Insert(model); } return(RedirectToAction(nameof(Register))); }
public ActionResult Assignment(Carnet model, CostCenterDropdown list) { model.AssignmentDate = DateTime.Now; model.CostCenter = (CostCenter)list.CostCenters.Where(x => x.Selected); model.CostCenterID = model.CostCenter.ID; var result = _repository.Update(model); if (!result) { return(new HttpNotFoundResult("Non c'è un blocchetto corrispondente")); } return(RedirectToAction(nameof(Assignment))); }
public void SelectCarnet(Guid idCarnet, Guid id) { CarnetType type = GetTypeById(idCarnet); Carnet carnet = new Carnet { Type = type, ClientID = id }; if (_carnetRepository.CheckIfExist(id)) { throw new ArgumentException("Posiadasz juz karnet", "original"); } else { _carnetRepository.SelectCarnet(carnet); } }
public async Task <JsonResult> Create([Bind(Include = "ExpedienteId,VacunaId,Fecha_Vacunacion,Expediente,Vacuna")] Carnet carnet) { ModelCustom(ModelState); if (ModelState.IsValid) { var result = await PostAsync("api/Carnet", carnet); if (result.IsSuccessStatusCode) { var resultdata = result.Content.ReadAsStringAsync().Result; carnet = JsonConvert.DeserializeObject <Carnet>(resultdata); return(Json(carnet)); } } var Error = await ErrorAsync("Carnet", "Create", "Error insertar vacuna compruebe los campos", 400); return(new JsonHttpStatusResult(new { Error }, HttpStatusCode.BadRequest)); }
public static void pruebaCarne() { ArbolBinarioBusqueda ArBin = new ArbolBinarioBusqueda(); int[] carnet = { 20, 15, 17, 30, 29, 43 }; Carnet car = new Carnet(); foreach (int d in carnet) { car.carnet = d; car.descripcion = $"insertar No.{d}"; ArBin.insertar(car); car = new Carnet(); } int pausa; pausa = 0; }
public async Task AddCarnetAsync(int carnetTypeNumber, string userEmail) { var allCarnetTypes = new CarnetsOfferViewModel().CarnetList; var selectedCarnet = allCarnetTypes.Single(x => x.CarnetTypeNumber == carnetTypeNumber); //getting right carnet type object from carnet list modelview var carnet = new Carnet() { CarnetTypeNumber = carnetTypeNumber, CarnetCategory = selectedCarnet.CarnetCategory, Name = selectedCarnet.Name, Quantity = selectedCarnet.Quantity, Price = selectedCarnet.Price, PurchasedAt = DateTime.UtcNow, OwnerEmail = userEmail, RemainQty = selectedCarnet.Quantity, IsActive = false, }; await _dbContext.AddAsync(carnet); await _dbContext.SaveChangesAsync(); }
public CompleteDto CheckComplete(Guid id) { Client client = GetDetails(id); Carnet carnet = GetCarnet(id); bool exist = false; bool active = false; if (carnet != null) { exist = true; active = carnet.IsActive; } CompleteDto c = new CompleteDto { Complete = client.ProfileComplete, Exist = exist, Active = active }; return(c); }
private void Click_CréerCarnet(object sender, RoutedEventArgs e) { if (txtNom.Text != "" && txtPrénom.Text != "") { if (this.col.GetCarnet(txtNom.Text, txtPrénom.Text) != null) { MessageBox.Show("Cet étudiant existe déjà", "Nouveau Carnet"); } else { Etudiant etd = new Etudiant(txtNom.Text, txtPrénom.Text); this.carnet = new Carnet(etd); this.col.AjouterCarnet(this.carnet); DialogResult = true; } } else { MessageBox.Show("Vous avez un ou plusieurs champs vide", "saisie incorrecte"); } }
public void ActivateCarnet(Carnet c) { _context.Update(c); _context.SaveChanges(); }
public void SelectCarnet(Carnet carnet) { _context.Add(carnet); _context.SaveChanges(); }
public void AddCarnet(Carnet t) { _context.Add(t); _context.SaveChanges(); }