public IHttpActionResult Get(string message) { string calBinaryContent = "empty"; if (!string.IsNullOrEmpty(message)) { if (!string.IsNullOrEmpty(message)) { switch (message.ToLower()) { case "welcome": calBinaryContent = "welcome_default"; break; case "february": calBinaryContent = "feb2017"; break; case "december": default: calBinaryContent = "welcome_default"; break; } } else { calBinaryContent = "welcome_default"; } } HUDCalmodel model = new HUDCalmodel(); model.image = System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("~/app_data/" + calBinaryContent + ".txt")); model.ReceivedOn = DateTime.Now.ToString(); model.RecievedBy = "*****@*****.**"; model.status = HttpStatusCode.OK.ToString(); return(Ok <HUDCalmodel>(model)); }
public IHttpActionResult Get(string id, string month) { string calBinaryContent1 = "empty"; string calBinaryContent2 = "empty"; if (!string.IsNullOrEmpty(id)) { if (id == "101") { if (!string.IsNullOrEmpty(month)) { switch (month.ToLower()) { case "january": calBinaryContent1 = "mar2017"; calBinaryContent2 = "mar2017"; break; case "february": calBinaryContent1 = "feb2017"; calBinaryContent2 = "mar2017"; break; case "march": calBinaryContent1 = "feb2017"; calBinaryContent2 = "mar2017"; break; case "december": default: calBinaryContent1 = "binarycal1"; calBinaryContent2 = "binarycal1"; break; } } else { calBinaryContent1 = "binarycal1"; calBinaryContent2 = "binarycal1"; } } else { calBinaryContent1 = "binarycal2"; calBinaryContent2 = "binarycal2"; } } HUDCalmodel model = new HUDCalmodel(); model.image1 = System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("~/app_data/" + calBinaryContent1 + ".txt")); model.image2 = System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("~/app_data/" + calBinaryContent2 + ".txt")); model.ReceivedOn = DateTime.Now.ToString(); model.RecievedBy = "*****@*****.**"; model.status = HttpStatusCode.OK.ToString(); //var result = new JsonResult(); //result.Data = model; //result.JsonRequestBehavior = JsonRequestBehavior.AllowGet; //return result; return(Ok <HUDCalmodel>(model)); }