Example #1
0
        public HttpResponseMessage Get()
        {
            Appversion Appversion = new Appversion();

            try
            {
                var appversion = GInfraEntities.AppversionMasters.Where(e => e.Status == "Y").ToList();
                if (appversion.Count > 0)
                {
                    foreach (var item in appversion)
                    {
                        AppversionResponse AppversionResponse = new AppversionResponse();

                        AppversionResponse.AppVersionUrl = item.AppVersionUrl.ToString();
                        AppversionResponse.AppVesrionId  = item.AppVesrionId.ToString();


                        AppversionResponse.Status = item.Status.ToString();

                        Appversion.Data.Add(AppversionResponse);
                    }


                    Appversion.Status  = true;
                    Appversion.Message = "App version List Fetch Successfully";


                    return(Request.CreateResponse(HttpStatusCode.OK, Appversion));
                }
                else
                {
                    Appversion.Status  = false;
                    Appversion.Message = "No Records Found";
                    return(Request.CreateResponse(HttpStatusCode.OK, Appversion));
                }
            }
            catch (Exception ex)
            {
                Appversion.Status  = false;
                Appversion.Message = "" + ex.Message + "";
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, Appversion));
            }
        }
Example #2
0
        public async Task <ResponseStatus> addCity(appversionRequest appversionRequest)
        {
            ResponseStatus status = new ResponseStatus();

            try
            {
                var versionname = appDbContex.appversions.Where(a => a.version == appversionRequest.version && a.deleted == false).FirstOrDefault();
                if (versionname == null)
                {
                    var        guId       = Guid.NewGuid();
                    Appversion appversion = new Appversion
                    {
                        id          = guId.ToString(),
                        version     = appversionRequest.version,
                        forceUpdate = appversionRequest.forceUpdate,
                        deleted     = false,
                        publishdate = DateTime.Now
                    };
                    // memoryCache.Remove("citylist");
                    appDbContex.appversions.Add(appversion);
                    await appDbContex.SaveChangesAsync();

                    status.status  = true;
                    status.message = "Save successfully!";
                    // status.lstItems = GetAllCity(cityRequest.stateId).Result.lstItems;
                    return(status);
                }
                else
                {
                    status.status  = false;
                    status.message = "Already Added!";
                }
            }
            catch (Exception ex)
            {
                status.status  = false;
                status.message = ex.Message;
                throw ex;
            }
            return(status);
        }