Esempio n. 1
0
        public bool UpdateFemaleModel(FemaleModelModel model)
        {
            var item = _femaleModels.Where(a => a.id == model.id).FirstOrDefault();

            item = model;
            return(true);
        }
Esempio n. 2
0
        public async void Register()
        {
            FemaleModelModel model = new FemaleModelModel();

            model.Username = loginmodel.UserName;
            model.Password = loginmodel.Password;
            await _femaleModelDataService.AddFemaleModel(model);

            navmanager.NavigateTo("/");
        }
        public async Task <FemaleModelModel> AddFemaleModel(FemaleModelModel model)
        {
            var modelJson = new StringContent(JsonSerializer.Serialize(model), System.Text.Encoding.UTF8, "application/json");

            var response = await _httpClient.PostAsync("api/FemaleModel", modelJson);

            if (response.IsSuccessStatusCode)
            {
                return(await JsonSerializer.DeserializeAsync <FemaleModelModel>(await response.Content.ReadAsStreamAsync()));
            }
            return(null);
        }
Esempio n. 4
0
        public IActionResult Post([FromBody] FemaleModelModel model)
        {
            if (model == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            model.Image     = GeneralStaticdata.chosenimage;
            model.imagepath = GeneralStaticdata.ImagePath;
            GeneralStaticdata.chosenimage = null;
            GeneralStaticdata.ImagePath   = null;
            return(Created("femalemodel", _dataService.AddFemaleModelReturnType(model)));
        }
Esempio n. 5
0
        public IActionResult Put([FromBody] FemaleModelModel model)
        {
            if (model == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var item = _dataService.ReturnFemaleModel(model.id);

            if (item == null)
            {
                return(NotFound());
            }

            _dataService.UpdateFemaleModel(model);

            return(NoContent()); //success
        }
Esempio n. 6
0
 public bool RemoveFemaleModel(FemaleModelModel model)
 {
     _femaleModels.Remove(model);
     return(true);
 }
Esempio n. 7
0
 public FemaleModelModel AddFemaleModelReturnType(FemaleModelModel model)
 {
     model.id = Guid.NewGuid().ToString();
     _femaleModels.Add(model);
     return(model);
 }
Esempio n. 8
0
 public bool AddFemaleModel(FemaleModelModel model)
 {
     model.id = Guid.NewGuid().ToString();
     _femaleModels.Add(model);
     return(true);
 }
 public async Task UpdateFemaleModel(FemaleModelModel model)
 {
     var modelJson = new StringContent(JsonSerializer.Serialize(model), System.Text.Encoding.UTF8, "application/json");
     await _httpClient.PutAsync("api/FemaleModel", modelJson);
 }