Ejemplo n.º 1
0
        public override Task <Empty> DeleteSystemLanguageCode(SystemLanguageCodePayload request, ServerCallContext context)
        {
            SystemLanguageCodePoco poco = _logic.Get(request.LanguageID);

            _logic.Delete(new SystemLanguageCodePoco[] { poco });
            return(new Task <Empty>(() => new Empty()));
        }
        public SystemLanguageCodePoco GetSingle(string Id)
        {
            SystemLanguageCodePoco systemLanguageCodePoco = new SystemLanguageCodePoco();

            systemLanguageCodePoco = _repository.GetSingle(c => c.LanguageID == Id);
            return(systemLanguageCodePoco);
        }
        public ActionResult Delete(string id)
        {
            var request = new
                          RestRequest($"api/careercloud/system/v1/languagecode/{id}");

            var response = _client.Execute <SystemLanguageCodePoco>(request);

            var systemCountryCode =
                JsonConvert.DeserializeObject <SystemLanguageCodePoco>(response.Content);

            SystemLanguageCodePoco[] pocos = new SystemLanguageCodePoco[]
            { systemCountryCode };

            var deleteRequest = new
                                RestRequest("api/careercloud/system/v1/languagecode", Method.DELETE)
            {
                RequestFormat = DataFormat.Json
            };

            deleteRequest.AddBody(pocos);

            _client.Execute(deleteRequest);

            return(View("Index"));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(string id, [Bind("LanguageID,Name,NativeName")] SystemLanguageCodePoco systemLanguageCodePoco)
        {
            if (id != systemLanguageCodePoco.LanguageID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(systemLanguageCodePoco);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SystemLanguageCodePocoExists(systemLanguageCodePoco.LanguageID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(systemLanguageCodePoco));
        }
Ejemplo n.º 5
0
        public SystemLanguageCodePoco GetSingleSystemLanguageCode(string Id)
        {
            var logic = new SystemLanguageCodeLogic(new EFGenericRepository <SystemLanguageCodePoco>(false));
            SystemLanguageCodePoco systemLanguageCodePoco = new SystemLanguageCodePoco();

            systemLanguageCodePoco = logic.GetSingle(Id);
            return(systemLanguageCodePoco);
        }
        public ActionResult DeleteConfirmed(string id)
        {
            SystemLanguageCodePoco systemLanguageCodePoco = systemLanguageLogic.GetSingle(l => l.LanguageID == id); //db.SystemLanguageCodes.Find(id);

            SystemLanguageCodePoco[] systemLangPoco = new SystemLanguageCodePoco[] { systemLanguageCodePoco };
            systemLanguageLogic.Remove(systemLangPoco);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 7
0
        public ActionResult DeleteConfirmed(string id)
        {
            SystemLanguageCodePoco systemLanguageCodePoco = db.SystemLanguageCodes.Find(id);

            db.SystemLanguageCodes.Remove(systemLanguageCodePoco);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 private void SystemLangCode_Init()
 {
     _systemLangCode = new SystemLanguageCodePoco()
     {
         LanguageID = String.Concat(Faker.Lorem.Letters(10)),
         NativeName = Truncate(Faker.Lorem.Sentence(), 50),
         Name       = Truncate(Faker.Lorem.Sentence(), 50)
     };
 }
 private SystemLanguageCodeReply FromPoco(SystemLanguageCodePoco poco)
 {
     return(new SystemLanguageCodeReply
     {
         LanguageID = poco.LanguageID.ToString(),
         Name = poco.Name.ToString(),
         NativeName = poco.NativeName.ToString()
     });
 }
 private Task <SystemLanguageCodeObj> TranslateFromPoco(SystemLanguageCodePoco poco)
 {
     return(Task.FromResult(new SystemLanguageCodeObj
     {
         LanguageID = poco.LanguageID,
         Name = poco.Name,
         NativeName = poco.NativeName
     }));
 }
Ejemplo n.º 11
0
 private SystemLanguageCode TranslateFromPoco(SystemLanguageCodePoco poco)
 {
     return(new SystemLanguageCode()
     {
         LanguageID = poco.LanguageID,
         Name = poco.Name,
         NativeName = poco.NativeName
     });
 }
Ejemplo n.º 12
0
 private SystemLanguageCodeReply FromPOCO(SystemLanguageCodePoco poco)
 {
     return(new SystemLanguageCodeReply()
     {
         LanguageID = poco.LanguageID,
         Name = poco.Name,
         NativeName = poco.NativeName
     });
 }
Ejemplo n.º 13
0
 public override Task <Empty> UpdateSystemLanguageCode(SystemLanguageCodePayload request, ServerCallContext context)
 {
     SystemLanguageCodePoco[] pocos = new SystemLanguageCodePoco[1];
     pocos[0].LanguageID = request.LanguageID;
     pocos[0].Name       = request.Name;
     pocos[0].NativeName = request.NativeName;
     _logic.Update(pocos);
     return(new Task <Empty>(null));
 }
 public ActionResult Edit([Bind(Include = "LanguageID,Name,NativeName")] SystemLanguageCodePoco systemLanguageCodePoco)
 {
     if (ModelState.IsValid)
     {
         SystemLanguageCodePoco[] systemLangPoco = new SystemLanguageCodePoco[] { systemLanguageCodePoco };
         systemLanguageLogic.Update(systemLangPoco);
         return(RedirectToAction("Index"));
     }
     return(View(systemLanguageCodePoco));
 }
Ejemplo n.º 15
0
        public IHttpActionResult GetSystemLanguageCode(string SystemLanguageCodeCode)
        {
            SystemLanguageCodePoco poco = _logic.Get(SystemLanguageCodeCode);

            if (poco == null)
            {
                return(NotFound());
            }
            return(Ok(poco));
        }
Ejemplo n.º 16
0
 public ActionResult Edit([Bind(Include = "LanguageID,Name,NativeName")] SystemLanguageCodePoco systemLanguageCodePoco)
 {
     if (ModelState.IsValid)
     {
         db.Entry(systemLanguageCodePoco).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(systemLanguageCodePoco));
 }
Ejemplo n.º 17
0
        private bool CheckLanguageID(SystemLanguageCodePoco poco)
        {
            bool result = true;

            if (string.IsNullOrEmpty(poco.LanguageID))
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 18
0
        public IHttpActionResult GetSystemLanguageCode(string systemLanguageCodeId)
        {
            SystemLanguageCodePoco appEdu = _logic.Get(systemLanguageCodeId);

            if (appEdu == null)
            {
                return(NotFound());
            }
            return(Ok(appEdu));
        }
        public IHttpActionResult GetSystemLanguageCode(string SystemLanguageCodeId)
        {
            SystemLanguageCodePoco systemLanguageCode = _logic.Get(SystemLanguageCodeId);

            if (systemLanguageCode == null)
            {
                return(NotFound());
            }
            return(Ok(systemLanguageCode));
        }
Ejemplo n.º 20
0
        private bool CheckNativeName(SystemLanguageCodePoco poco)
        {
            bool result = true;

            if (string.IsNullOrEmpty(poco.NativeName))
            {
                result = false;
            }
            return(result);
        }
        public ActionResult GetSystemLanguageCode(string languageId)
        {
            SystemLanguageCodePoco poco = _logic.Get(languageId);

            if (poco == null)
            {
                return(NotFound());
            }
            return(Ok(poco));
        }
Ejemplo n.º 22
0
        public ActionResult Create([Bind(Include = "LanguageID,Name,NativeName")] SystemLanguageCodePoco systemLanguageCodePoco)
        {
            if (ModelState.IsValid)
            {
                db.SystemLanguageCodes.Add(systemLanguageCodePoco);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(systemLanguageCodePoco));
        }
Ejemplo n.º 23
0
        public override Task <SystemLanguageCodePayLoad> ReadSystemLanguageCode(IdRequestLanguageCode request, ServerCallContext context)
        {
            SystemLanguageCodePoco poco = _logic.Get(request.LanguageID);

            return(new Task <SystemLanguageCodePayLoad>(() => new SystemLanguageCodePayLoad()
            {
                LanguageID = poco.LanguageID.ToString(),
                Name = poco.Name,
                NativeName = poco.NativeName
            }));
        }
        public override Task <SystemLanguageCodeObj> GetSystemLanguageCode(IdRequestSystemLanguageCode request, ServerCallContext context)
        {
            var _logic = new SystemLanguageCodeLogic(new EFGenericRepository <SystemLanguageCodePoco>());
            SystemLanguageCodePoco poco = _logic.Get(request.LanguageID);

            if (poco == null)
            {
                throw new ArgumentOutOfRangeException();
            }
            return(TranslateFromPoco(poco));
        }
Ejemplo n.º 25
0
 public override Task <Empty> DeleteSystemLanguageCode(SystemLanguageCodePayLoad request, ServerCallContext context)
 {
     SystemLanguageCodePoco[] pocos = new SystemLanguageCodePoco[] { new SystemLanguageCodePoco()
                                                                     {
                                                                         LanguageID = request.LanguageID,
                                                                         Name       = request.Name,
                                                                         NativeName = request.NativeName
                                                                     } };
     _logic.Delete(pocos);
     return(new Task <Empty>(() => new Empty()));
 }
Ejemplo n.º 26
0
        public async Task <IActionResult> Create([Bind("LanguageID,Name,NativeName")] SystemLanguageCodePoco systemLanguageCodePoco)
        {
            if (ModelState.IsValid)
            {
                _context.Add(systemLanguageCodePoco);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(systemLanguageCodePoco));
        }
 public override Task <Empty> UpdateSystemLanguageCode(SystemLanguageCodePayload request, ServerCallContext context)
 {
     SystemLanguageCodePoco[] pocos = new SystemLanguageCodePoco[1];
     foreach (var poco in pocos)
     {
         poco.LanguageID = request.LanguageID;
         poco.Name       = request.Name;
         poco.NativeName = request.NativeName;
     }
     _logic.Update(pocos);
     return(new Task <Empty>(() => new Empty()));
 }
Ejemplo n.º 28
0
        public override Task <Empty> CreateSystemLanguageCode(SystemLanguageCodePayload request, ServerCallContext context)
        {
            SystemLanguageCodePoco poco = new SystemLanguageCodePoco()
            {
                LanguageID = request.LanguageID,
                Name       = request.Name,
                NativeName = request.NativeName
            };

            _logic.Add(new SystemLanguageCodePoco[] { poco });
            return(null);
        }
        public ActionResult GetSystemLanguageCode(string code)
        {
            SystemLanguageCodePoco poco = _logic.Get(code);

            if (poco == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(poco));
            }
        }
Ejemplo n.º 30
0
        public override Task <SystemLanguageCode> GetSystemLanguageCode(SysLangCodeIdRequest request, ServerCallContext context)
        {
            var logic = new SystemLanguageCodeLogic(new EFGenericRepository <SystemLanguageCodePoco>());

            SystemLanguageCodePoco poco = logic.Get(request.Id);

            if (poco == null)
            {
                throw new ArgumentOutOfRangeException();
            }

            return(new Task <SystemLanguageCode>(() => { return TranslateFromPoco(poco); }));
        }