public async Task <IActionResult> Edit(string id, [Bind("Code,Name")] SystemCountryCodePoco systemCountryCodePoco)
        {
            if (id != systemCountryCodePoco.Code)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(systemCountryCodePoco);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SystemCountryCodePocoExists(systemCountryCodePoco.Code))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(systemCountryCodePoco));
        }
Exemple #2
0
        public override Task <Empty> DeleteSystemCountryCode(SystemCountryCodePayload request, ServerCallContext context)
        {
            SystemCountryCodePoco poco = _logic.Get(request.Code);

            _logic.Delete(new SystemCountryCodePoco[] { poco });
            return(new Task <Empty>(() => new Empty()));
        }
Exemple #3
0
        public SystemCountryCodePoco GetSingle(string Id)
        {
            SystemCountryCodePoco systemCountryCodePoco = new SystemCountryCodePoco();

            systemCountryCodePoco = _repository.GetSingle(c => c.Code == Id);
            return(systemCountryCodePoco);
        }
Exemple #4
0
        public SystemCountryCodePoco GetSingleSystemCountryCode(string Id)
        {
            var logic = new SystemCountryCodeLogic(new EFGenericRepository <SystemCountryCodePoco>(false));
            SystemCountryCodePoco systemCountryCodePoco = new SystemCountryCodePoco();

            systemCountryCodePoco = logic.GetSingle(Id);
            return(systemCountryCodePoco);
        }
        public ActionResult DeleteConfirmed(string id)
        {
            SystemCountryCodePoco systemCountryCodePoco = systemCountryCodeLogic.GetSingle(c => c.Code == id);

            SystemCountryCodePoco[] systemCountryCodes = new SystemCountryCodePoco[] { systemCountryCodePoco };
            systemCountryCodeLogic.Remove(systemCountryCodes);
            return(RedirectToAction("Index"));
        }
 private void SystemCountry_Init()
 {
     _systemCountry = new SystemCountryCodePoco
     {
         Code = String.Concat(Faker.Lorem.Letters(10)),
         Name = Truncate(Faker.Name.FullName(), 50)
     };
 }
        public ActionResult DeleteConfirmed(string id)
        {
            SystemCountryCodePoco systemCountryCodePoco = db.SystemCountryCodes.Find(id);

            db.SystemCountryCodes.Remove(systemCountryCodePoco);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public IHttpActionResult GetSystemCountryCode(string SystemCountryCode)
        {
            SystemCountryCodePoco sc = _logic.Get(SystemCountryCode);

            if (sc == null)
            {
                return(NotFound());
            }
            return(Ok(sc));
        }
Exemple #9
0
        public IHttpActionResult GetSystemCountryCode(string systemCountryCodeId)
        {
            SystemCountryCodePoco countryCode = _logic.GetSingle(systemCountryCodeId);

            if (countryCode == null)
            {
                return(NotFound());
            }
            return(Ok(countryCode));
        }
 public ActionResult Edit([Bind(Include = "Code,Name")] SystemCountryCodePoco systemCountryCodePoco)
 {
     if (ModelState.IsValid)
     {
         SystemCountryCodePoco[] systemCountryCodes = new SystemCountryCodePoco[] { systemCountryCodePoco };
         systemCountryCodeLogic.Update(systemCountryCodes);
         return(RedirectToAction("Index"));
     }
     return(View(systemCountryCodePoco));
 }
Exemple #11
0
        public override Task <SystemCountryCodePayload> ReadSystemCountryCode(IdRequest request, ServerCallContext context)
        {
            SystemCountryCodePoco poco = _logic.Get(request.Code);

            return(new Task <SystemCountryCodePayload>(() => new SystemCountryCodePayload()
            {
                Code = poco.Code,
                Name = poco.Name
            }));
        }
        private bool CheckName(SystemCountryCodePoco poco)
        {
            bool result = true;

            if (string.IsNullOrEmpty(poco.Name))
            {
                result = false;
            }
            return(result);
        }
        public override Task <Empty> UpdateSystemCountryCode(SystemCountryCodePayload request, ServerCallContext context)
        {
            SystemCountryCodePoco[] pocos = new SystemCountryCodePoco[1];

            pocos[0].Code = request.Code;
            pocos[0].Name = request.Name;

            _logic.Update(pocos);
            return(new Task <Empty>(null));
        }
        public IHttpActionResult GetSystemCountryCode(string code)
        {
            SystemCountryCodePoco poco = _logic.Get(code);

            if (poco == null)
            {
                return(NotFound());
            }
            return(Ok(poco));
        }
        public ActionResult GetSystemCountryCode(String id)
        {
            SystemCountryCodePoco poco = _logic.Get(id);

            if (poco == null)
            {
                return(NotFound());
            }
            return(Ok(poco));
        }
 public ActionResult Edit([Bind(Include = "Code,Name")] SystemCountryCodePoco systemCountryCodePoco)
 {
     if (ModelState.IsValid)
     {
         db.Entry(systemCountryCodePoco).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(systemCountryCodePoco));
 }
Exemple #17
0
        public IHttpActionResult GetSystemCountryCode(string systemCountryCodeCode)
        {
            SystemCountryCodePoco appEdu = _logic.Get(systemCountryCodeCode);

            if (appEdu == null)
            {
                return(NotFound());
            }
            return(Ok(appEdu));
        }
        public override Task <Empty> DeleteSystemCountryCode(SystemCountryCodePayLoad request, ServerCallContext context)
        {
            SystemCountryCodePoco[] pocos = new SystemCountryCodePoco[] { new SystemCountryCodePoco()
                                                                          {
                                                                              Code = request.Code,
                                                                              Name = request.Name
                                                                          } };
            _logic.Delete(pocos);

            return(new Task <Empty>(() => new Empty()));
        }
 public override Task <Empty> UpdateSystemCountryCode(SystemCountryCodePayload request, ServerCallContext context)
 {
     SystemCountryCodePoco[] pocos = new SystemCountryCodePoco[1];
     foreach (var poco in pocos)
     {
         poco.Code = request.Code;
         poco.Name = request.Name;
     }
     _logic.Update(pocos);
     return(new Task <Empty>(() => new Empty()));
 }
        public ActionResult Create([Bind(Include = "Code,Name")] SystemCountryCodePoco systemCountryCodePoco)
        {
            if (ModelState.IsValid)
            {
                db.SystemCountryCodes.Add(systemCountryCodePoco);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(systemCountryCodePoco));
        }
        public override Task <Empty> CreateSystemCountryCode(SystemCountryCodePayload request, ServerCallContext context)
        {
            SystemCountryCodePoco poco = new SystemCountryCodePoco()
            {
                Code = request.Code,
                Name = request.Name
            };

            _logic.Add(new SystemCountryCodePoco[] { poco });
            return(null);
        }
        public async Task <IActionResult> Create([Bind("Code,Name")] SystemCountryCodePoco systemCountryCodePoco)
        {
            if (ModelState.IsValid)
            {
                _context.Add(systemCountryCodePoco);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(systemCountryCodePoco));
        }
        public SystemCountryCodePoco[] GetArray(SystemCountryCodePayload request)
        {
            SystemCountryCodePoco poco = new SystemCountryCodePoco()
            {
                Code = request.Code,
                Name = request.Name
            };

            SystemCountryCodePoco[] pocos = new SystemCountryCodePoco[1];
            pocos[0] = poco;
            return(pocos);
        }
        public override Task <Empty> UpdateSystemCountryCode(SystemCountryCodePayload request, ServerCallContext context)
        {
            _ = _logic.Get(request.Code) ?? throw new ArgumentNullException("No System Country Code with this Code Found");
            SystemCountryCodePoco poco = new SystemCountryCodePoco()
            {
                Code = request.Code,
                Name = request.Name
            };

            _logic.Update(new SystemCountryCodePoco[] { poco });
            return(null);
        }
        public ActionResult GetSystemCountryCode(string code)
        {
            SystemCountryCodePoco poco = logic.Get(code);

            if (poco != null)
            {
                return(Ok(poco));
            }
            else
            {
                return(NotFound());
            }
        }
Exemple #26
0
        public ActionResult GetSystemCountryCode(string systemCountryCodeId)
        {
            SystemCountryCodePoco systemCountryCodePoco = _logic.Get(systemCountryCodeId);

            if (systemCountryCodePoco == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(systemCountryCodePoco));
            }
        }
        public ActionResult GetSystemCountryCode(string systemcountrycode)
        {
            SystemCountryCodePoco poco = _logicref.Get(systemcountrycode);

            if (poco == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(poco));
            }
        }
Exemple #28
0
        public List <SystemCountryCodePoco> ProtoToPoco(SysCountryCodeArray request)
        {
            List <SystemCountryCodePoco> pocos = new List <SystemCountryCodePoco>();
            var inputList = request.SysCountryCode.ToList();

            foreach (var item in inputList)
            {
                var poco = new SystemCountryCodePoco();
                poco.Code = item.Code;
                poco.Name = item.Name;
                pocos.Add(poco);
            }
            return(pocos);
        }
        // GET: SystemCountryCode/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SystemCountryCodePoco systemCountryCodePoco = systemCountryCodeLogic.GetSingle(c => c.Code == id);

            if (systemCountryCodePoco == null)
            {
                return(HttpNotFound());
            }
            return(View(systemCountryCodePoco));
        }
        // GET: SystemCountryCodes/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SystemCountryCodePoco systemCountryCodePoco = db.SystemCountryCodes.Find(id);

            if (systemCountryCodePoco == null)
            {
                return(HttpNotFound());
            }
            return(View(systemCountryCodePoco));
        }