Пример #1
0
        public static string ChangeProgress(string jsonString)
        {
            var cdb = new ConnectDB("Database1");

            if (jsonString == "")
            {
                return("nil");
            }
            var receivedData = JsonConvert.DeserializeObject <Dictionary <string, string> >(jsonString);

            try
            {
                var participant = new ParticipantModel
                {
                    ProgressId      = int.Parse(receivedData["progressId"]),
                    ParticipantName = receivedData["participantName"],
                    CurrentProgress = int.Parse(receivedData["currentProgress"])
                };
                var password = receivedData["progPassword"];
                if (cdb.IsCorrectPassword(participant, password))
                {
                    cdb.ChangeProgress(participant);
                    return("success");
                }
                return("wrongPassword");
            }
            catch (Exception ex)
            {
                var thisPage = new GetJsonString();
                thisPage.WriteErrorLog(ex.Message);
                return("error");
            }
        }